StateHolder
Base class for manipulating state.
Constructor Summary
| Public Constructor | ||
| public |
Creates a new state holder object. |
|
Method Summary
| Public Methods | ||
| public |
deleteState(path: Array) Deletes given state values. |
|
| public |
Runs all registered callbacks passing the object itself. |
|
| public |
Returns the initial state for the object. |
|
| public |
Returns the state or the requested property. |
|
| public |
mergeState(path: Array, value: any) Merges given state values. |
|
| public |
Registers a callback to be executed at every state change. |
|
| public |
Restores the state to the initial state. |
|
| public |
Sets given state values. |
|
| public |
unregister(callback: Function) Removes a callback previously registered. |
|
| public |
updateState(path: Array, callback: Function) Updates state values. |
|
Public Constructors
Public Methods
public deleteState(path: Array) source
Deletes given state values.
Params:
| Name | Type | Attribute | Description |
| path | Array | to the state value |
public getState(path: Array): any source
Returns the state or the requested property.
Params:
| Name | Type | Attribute | Description |
| path | Array | to the wanted state property |
Return:
| any | value |
public mergeState(path: Array, value: any) source
Merges given state values.
Params:
| Name | Type | Attribute | Description |
| path | Array | to the state value |
|
| value | any |
public register(callback: Function, context: Object, trace: Error): Function source
Registers a callback to be executed at every state change.
public setState(path: Array, value: any) source
Sets given state values.
Params:
| Name | Type | Attribute | Description |
| path | Array | to the state value |
|
| value | any |