Methods
createStateUpdater(updateAction, params) → {StateUpdaterOnActions}
Create an instance of state updater that uses an action function, which
doesn't require to be executed in any context (e.g. a method of an
object, or a function which use `this` pointer) and requires the passed
parameters.
Parameters:
Name | Type | Description |
---|---|---|
updateAction |
Action | The function which update the shared state require by the actions which will be executed by the returned instance. The function MUST return a promise. |
params |
* | The parameters to pass to the updateAction
each time that it will be executed. |
- Source:
Returns:
- The instance which will call the
updateAction
with the passed parameters when required.
createStateUpdaterCtx(updateAction, ctx, params) → {StateUpdaterOnActions}
Create an instance of state updater that uses an action function, which
requires to be executed in any context (e.g. a method of an object, or a
function which use
this
pointer) and requires the passed
parameters.
Parameters:
Name | Type | Description |
---|---|---|
updateAction |
Action | The function which update the shared state require by the actions which will be executed by the returned instance. The function MUST return a promise. |
ctx |
* | The context to use for calling the action (i.e.
this pointer). |
params |
* | The parameters to pass to the updateAction
each time that will be executed. |
- Source:
Returns:
- The instance which will call the
updateAction
with the passed parameters when required.
Type Definitions
(async) Action()
Action is a function which returns a promise; in order to notify that the
state must be updated, it MUST return a resolved promise which the value
returned by the
updateState
method of the StateUpdaterOnActions
instance which is used to call the action.
- Source: