1.0.1 • Published 3 years ago
@actumjs/actum v1.0.1
What is Actumjs?
Actumjs is a Javascript library to manage application state. You can use Actumjs with front-end libraries and frameworks like Reactjs,Vue and Angular. it provides a state which is accessible to all other components of an application. The only way to to update the applicaiton state is to trigger an action. Read more
Installation
Using NPM
$ npm install @actumjs/actum
Using Yarn
$ yarn add @actumjs/actum
With script tag
<script type="text/Javascript" src ="https://actumjs.github.io/dist/v1.0.0/actum.js"></script>
Creating Store
import {createStore} from '@actumjs/actum';
//initial state of store
const initial_state = { count:0 };
const store = createStore(initial_state);
Adding Actions
store.addAction("increment",(payload,state)=>{ state.count++; });
Listening to action
//listening to increment action
const afterIncrement = store.after("increment",(payload,state)=>{
//your code to handle action
})