Class: Store

Store(initialStateopt, reduceropt)

Redux-like store. Store emits a "change" event with the nextState every time the state has been changed.

Constructor

new Store(initialStateopt, reduceropt)

Parameters:
Name Type Attributes Default Description
initialState object <optional>
{}
reducer function <optional>
Source:

Members

(static, non-null) STATE :Object

State definition.
Type:
  • Object
Source:

Methods

dispatch(action) → {Store}

Dispatch an action to the store. Each action is identified by a given actionType, and can contain an optional payload with any kind of information.
Parameters:
Name Type Description
action Object | function
Source:
Returns:
Type
Store

disposed()

Source:

getState() → {object}

Returns current state. Warning: that state cannot be modified anyway.
Source:
Returns:
Current state
Type
object

registerReducer(reducer)

Set's store reducer. A reducer is a function that receives a state, an actionType and an optional payload with information, and returns a new state without altering the original one.
Parameters:
Name Type Description
reducer function
Source: