Table of Contents
Heridux
Creation of Heridux store
Parameters
STATE_PROPERTY
String string name for this slice of state. Generated actions wille use this as a prefix.
getState
Get store slice
Parameters
state
Object? global state (if not specified, call getState method of redux store)
Returns Object store slice
get
Get js value of a first level key
Parameters
key
String key name_state
Object? global state (if not specified, call getState method of redux store)
Returns any key value
setInitialState
Define the initial state of the store slice
Parameters
Returns undefined
createAction
Create action/reducer couple
Parameters
name
String action short namereducer
Function function to modify the state
Examples
const myStore = new Heridux("myPartialStore")
myStore.setInitialState({
list : ["foo", "bar"]
})
myStore.createAction("pop", state => state.update("list", arr => arr.pop())
myStore.execAction("pop")
myStore.get("list")
Returns undefined
execAction
Execute action registered by createAction method
Parameters
name
String action short nameoptions
Object additional parameters
Returns undefined
register
Register heridux store in global redux store
Returns undefined
dispatch
dispatch any action on global redux store
Parameters
Returns undefined