Liking cljdoc? Tell your friends :D
Mostly cljs.
Exceptions indicated.

deepstate.action.async


async-actioncljs

(async-action key
              {action-path :deepstate.action/path :as action}
              action-promise-or-action-map)

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-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 fn is supplied then it will be used to navigate each time the action value is rendered (including ::action/inflight). the navigate fn will be called with a map of {::action/state <action-state> ::action/path <action-state-path-in-full-state> :deepstate/state <full-state>} so it can easily destructure the state of the action or the whole state, and is expected to return a url string to navigate to or nil

::action/navigate-inflight, ::action/navigate-success and ::action/navigate-error keys are also available to navigate only on some 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-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` fn is supplied then it will be used to
 navigate each time the action value is rendered (including
 `::action/inflight`). the navigate fn will be called with a map of
 {`::action/state` `<action-state>`
  `::action/path` `<action-state-path-in-full-state>`
  `:deepstate/state` `<full-state>`}
 so it can easily destructure the state of the action or the
 whole state, and is expected to return a url string to navigate to or
 `nil`

 `::action/navigate-inflight`, `::action/navigate-success` and
 `::action/navigate-error` keys are also available to navigate
 only on some conditions
sourceraw docstring

async-navigate-fncljs

(async-navigate-fn action-path
                   {navigate-fn :deepstate.action/navigate
                    inflight-navigate-fn :deepstate.action/navigate-inflight
                    success-navigate-fn :deepstate.action/navigate-success
                    error-navigate-fn :deepstate.action/navigate-error
                    :as _action-map})

takes a fn of {::action/state <action-state> ::action/path <action-state-path-in-full-state> :deepstate/state <full-state>} and adapts it to be a fn of the <full-state>

this allows the navigate-fns supplied to async-action to easily destructure the specific state resulting from the action, or to examine the entire current state

takes a fn of
   {`::action/state` `<action-state>`
    `::action/path` `<action-state-path-in-full-state>`
    `:deepstate/state` `<full-state>`}
 and adapts it to be a fn of the `<full-state>`

this allows the navigate-fns supplied to `async-action` to
easily destructure the specific state resulting from the
action, or to examine the entire current state
sourceraw docstring

def-async-actionclj/smacro

(def-async-action key [action-bindings] action-or-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 data
  • action-bindings : fn bindings to destructure the action
  • action-or-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
 - `action-or-action-map` : form returning a promise of the
    result or a map as described in `async-action` - may
    refer to `action-bindings`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close