key-value-state
observable stateful key value object store
Usage
const store = store;// es6; // create a Store instance with an initial stateconst myStore = ; console;//=> 'bar' myStore;console;//=> true // Use dot-notation to access nested propertiesmyStore;console;//=> {baz: true} myStore;console;//=> undefined
API
store([state])
Returns a new instance.
state
Type: Object
Instance
You can use dot-notation in a key
to access nested properties.
.set(key, value)
Set an item.
.set(object)
Set multiple items at once.
.get(key)
Get an item.
.has(key)
Check if an item exists.
.delete(key)
Delete an item.
.size
Get the item count.
.subscribe(key, handler)
Subscribe to changes on an object. You can use dot-notation here also
.clone()
Create a clone of the store instance
.cloneState()
Create a clone of the state
.getState()
Get the current state.
.getLastState()
Get the last state.
.toJSON()
Get the sored data as JSON.
License
MIT