Package Exports
- async-lifecycle
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (async-lifecycle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
async-lifecycle
Generic async lifecycle actions and reducer.
Methods
composeAction
Creates an asynchronous action. The argument objects may have properties:
group
The name of the action group, required.fire
The action function, required.args = empty.array
key
cachekey
container = "data"
- Astring
of the property for the container in the store or afunction
which returns the cache containerobject
, like(state, ...args) => state.foo.bar
callbackBefore
Called before callingfire
.callbackSuccess
Called before dispatching theSUCCESS
action.callbackAfter
Called after dispatching theSUCCESS
action.callbackError
Called before dispatching theERROR
action.extra
timeout
Timeout until expiry in milliseconds, default 300000 (= 5 minutes).
When multiple objects are specified:
Callback functions are merged into wrapper functions, other properties are
overwritten as in Object.assign
.
loadingProgress
Determines if the given argument value corresponds to a state where data is
loading. E.g. loadingProgress("init") // true
asyncReducer
Recalculates state from current state and an action.
Action postfixes
Value | Description |
---|---|
INIT |
Start |
HIT |
Current data already present |
QUIT |
Data already loading |
SUCCESS |
Data loaded successfully |
ERROR |
Error |
EXIT |
Finish |
INVALIDATE |
Mark data as not current |
INVALIDATEALL |
Mark all data as not current |
CLEAR |
Delete all data |
Values for loading
property
Value | Description | Data present | Data current |
---|---|---|---|
init |
Loading | No | N/A |
success |
Success | Yes | Yes |
invalid |
Invalidated | Yes | No |
reinit |
Reloading | Yes | No |
error |
Error | No | N/A |
Build this package
yarn prettier
yarn lint
yarn build
Publish this package
npm login
npm publish