Coder Social home page Coder Social logo

januschu / activejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from activejs/activejs

0.0 0.0 0.0 347 KB

Pragmatic, Reactive State Management for JavaScript Apps

Home Page: https://activejs.dev

License: Other

JavaScript 0.71% TypeScript 81.27% HTML 11.76% SCSS 6.26%

activejs's Introduction


Pragmatic, Reactive State Management for JavaScript Apps

npm i @activejs/core

๐Ÿš€ Get Started

๐Ÿ“– Documentation

๐Ÿคพ Playground

๐Ÿ“‘ TodoMVC Example

โšก Quick Example

This is how an implementation of a simple counter looks like, using a NumUnit, one of the reactive data structures that ActiveJS provides. The NumUnit stores and provides a number value at all times ensuring the type-safety.

// initialize a reactive data structure to store numbers
const counter = new NumUnit(); // with default initial-value 0

// two pure functions to produce an appropriate new value
const increment = value => value + 1;
const decrement = value => value - 1;

// subscribe for reactive value access, and log the value
counter.subscribe(value => console.log(value));
// immediately logs 0, and will log any future values

// increment
counter.dispatch(increment); // you'll see 1 in the console
// the pure function is called with the current value and
// the returned value is dispatched automatically

// decrement
counter.dispatch(decrement); // you'll see 0 in the console
// that's it our counter is complete

// you can also access the value directly
console.log(counter.value()); // logs 0

๐Ÿ“Š Quick Comparisons

A simple "counter" implemented in Redux vs ActiveJS.



A simple "counter" implemented in NgRx vs ActiveJS.

๐Ÿค Contributing

We welcome all contributions, whether you're reporting an issue, helping us fix bugs, improve the docs, or spread the word. We also welcome your suggestions and feedback.

โš– Licence

MIT

๐Ÿ’ป Author

Ankit Singh

activejs's People

Contributors

dabalyan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.