(async-action key
{action-path :deepstate.action/path :as action}
action-promise-or-async-action-map
state)
a promise-based async action handler providing a consistent format for handling and recording emerging action state, and for interacting with navigation
key
: the ::action/key
to match a dispatch
. identifies the action,
and is the default path of the action state in state
action
: the action value being handled
::action/path
- instead of updating the state
at key
,
update the state
at path
action-promise-or-async-action-map
: a promise of a result,
or a map {::action/async <action-promise> ::action/navigate <navigate-fn>}
state
will be updated with a map with these keys:
::action/status
- ::inflight, ::success or ::error
::action/action
- the action value
::action/result
- the result value
::action/error
- any error value
if an ::action/navigate
url is supplied then it will be used to
navigate each time the action is handled (including
::action/inflight
)
::action/navigate-inflight
, ::action/navigate-success
and
::action/navigate-error
keys are also available to navigate
only on particular conditions
a promise-based async action handler providing a consistent format for handling and recording emerging action state, and for interacting with navigation - `key` : the `::action/key` to match a `dispatch`. identifies the action, and is the default path of the action state in `state` - `action` : the action value being handled - `::action/path` - instead of updating the `state` at `key`, update the `state` at `path` - `action-promise-or-async-action-map` : a promise of a result, or a map `{::action/async <action-promise> ::action/navigate <navigate-fn>}` `state` will be updated with a map with these keys: `::action/status` - ::inflight, ::success or ::error `::action/action` - the action value `::action/result` - the result value `::action/error` - any error value if an `::action/navigate` url is supplied then it will be used to navigate each time the action is handled (including `::action/inflight`) `::action/navigate-inflight`, `::action/navigate-success` and `::action/navigate-error` keys are also available to navigate only on particular conditions
(async-navigate-url {navigate-url :deepstate.action/navigate
inflight-navigate-url :deepstate.action/navigate-inflight
success-navigate-url :deepstate.action/navigate-success
error-navigate-url :deepstate.action/navigate-error
:as _action-map}
action-path
state)
(def-async-action key
[state-bindings action-bindings]
action-promise-or-async-action-map)
define an action handler to service a promise-based async action,
setting initial state and state after the action has completed
in a common schema described in async-action
key
: the action key and the path in the state
for
the request status and response value dataaction-bindings
: fn bindings to destructure the action mapaction-promise-or-async-action-map
: form returning a promise of the
result or a map as described in async-action
- may
refer to action-bindings
define an action handler to service a promise-based async action, setting initial state and state after the action has completed in a common schema described in `async-action` - `key` : the action key and the path in the `state` for the request status and response value data - `action-bindings` : fn bindings to destructure the action map - `action-promise-or-async-action-map` : form returning a promise of the result or a map as described in `async-action` - may refer to `action-bindings`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close