Justore
We don't need flux , just the store!
Installation
npm install justore --save
Basic Usage
var justore = ;var initData = {};var store = initData'Store Name'; //Write or change data to store, return a Promisestore; //Subscribe to changelet subscription = store;//Remember to clean upsubscription;
Advanced usage
store.batchWrite([keyPaths], manipulateFunction);
Batch write multiple data to the store, only emit if it's listed on the keyPaths
store;
-
store.write(keyPath, data [,options])
Write data to the store, return store
store;
-
store.sub(keyPath[,onNext][,immediate])
Subscribe to the store, if onNext is defined, return an Rx Subscription, else return an Rx stream
store;
-
store.read(keyPath)
Get value for attribute by passing the key.
store //--> 'drink'
-
store.delete(keyPath)
Useful when you want to delete a root key and it's data
store store //--> {}
-
store.report()
return the full store data. You cannot manipulate it
-
store.debugOn
if a key in this array, will toggle JS breakpoints when writing that key
React Mixin helper
-
store.createReactMixin(key)
Return a mixin. Will call
onStoreChange
method on a React component when store change.
Auto unsubscibe
If the subscribed data has been deleted (not set to undefined), the subscription will unsubscribe automatically
Browser support
IE11 or higher