0.0.1 • Published 8 years ago

sredux v0.0.1

Weekly downloads
12
License
-
Repository
github
Last release
8 years ago

SRedux

Simple Redux-like library, in plain JavaScript

Totally inspired in Redux

Installation

Via npm on Node:

npm install sredux

In your browser: TBD

Usage

// your reducer function
function reducer(state, action) {
    return state + 1;
}

// create store with reducer and optional initial state (undefined as default value)    
var store = sredux.createStore(reducer, 0);

// subscribe to states, returning unsubscribe function
var unsubscribe = store.subscribe(function () {
    console.log('new state', store.getState());
});

// send action
store.dispatch({ type: 'ANY ACTION' });
// new state 1

// unsubscribe
unsubscribe();

Samples

TBD

Versions

  • 0.0.1 Published

Contribution

Feel free to file issues and submit pull requests � contributions are welcome.

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.