A simple state observing mechanism that only fires when the stored value is compared to true.
Contains a callback function that fires depending on the truthfulness of validFn
.
Contains a callback function that fires depending on the truthfulness of the parent state.
Creates a new group of State
and Action
.
Adds a new state into the group. Throws new Error
when the key already exists.
The key of the state
The value of the state
Contains callbackFn
and validFn
.
Defaults to:
options = {
callbackFn: (val)=>{},
validFn: (val)=>true
}
The callback function when validFn
returns true
.
State validity check function.
Updates the value of the state by the key. Throws new Error
when key is not found.
To be developed.
To be developed.
Returns the value of the state by key. Throws new Error
when key is not found.
Adds a new action depeding on the dependsOn
array of states.
"AND"
or "OR"
.
Flag | Effect |
---|---|
"AND" |
All parents' validity must be true to fire the action |
"OR" |
Only requires one of the parents' validity to be true to fire the action |