Liking cljdoc? Tell your friends :D

jtk-dvlp.re-frame.tasks


as-taskcljs

(as-task)
(as-task name-or-task)
(as-task name-or-task effects)
(as-task name-or-task effects wait-for-tasks)
(as-task name-or-task effects wait-for-tasks debounce-ms)

Creates an interceptor to mark an event and its effects as task. Also see wait-for to wait for task. Give it a name of the task or map with at least a :name key or nil / nothing to use the event name. Tasks can be used via subscriptions tasks-sub and running?-sub.

Given vector effects will be used to identify effects to monitor for the task. Can be the keyword of the effect or an vector of effects path (to handle special :fx effect). Completion keys must be registered by reg-completion-keys-for-effect for the effects.

Given sugar wait-for-tasks to also inject wait-for interceptor, see documentation wait-for for details. Given sugar debounce-ms to also inject debounce interceptor, see documentation debounce for details.

Within your event handler use ::task as effect to modify your task data.

A task carries ::id, its :name, the event that opened it under ::event and whatever the ::task effect added. All of it is yours to read via get-tasks or tasks-sub.

See the *-original-event functions to handle as-tasks effect completion handlers. See attach-after-event to attach events to call after task completion.

Creates an interceptor to mark an event and its effects as task. Also see [[wait-for]] to wait for task.
Give it a name of the task or map with at least a `:name` key or nil / nothing to use the event name.
Tasks can be used via subscriptions [[tasks-sub]] and [[running?-sub]].

Given vector `effects` will be used to identify effects to monitor for the task. Can be the keyword of
the effect or an vector of effects path (to handle special `:fx` effect). Completion keys must be
registered by [[reg-completion-keys-for-effect]] for the effects.

Given sugar `wait-for-tasks` to also inject [[wait-for]] interceptor, see documentation [[wait-for]] for
details. Given sugar `debounce-ms` to also inject [[debounce]] interceptor, see documentation [[debounce]]
for details.

Within your event handler use `::task` as effect to modify your task data.

A task carries `::id`, its `:name`, the event that opened it under
`::event` and whatever the `::task` effect added. All of it is yours to
read via [[get-tasks]] or [[tasks-sub]].

See the `*-original-event` functions to handle as-tasks effect completion handlers.
See [[attach-after-event]] to attach events to call after task completion.
sourceraw docstring

assoc-orignal-eventcljs

(assoc-orignal-event event original-event)

Assocs original-event within maybe task event, returns maybe modified event.

Assocs `original-event` within maybe task `event`, returns maybe modified `event`.
sourceraw docstring

attach-after-eventcljs

(attach-after-event db id-or-task event)

Attaches event to call after task completion.

Attaches event to call after task completion.
sourceraw docstring

claimcljs

(claim context claim-key)

Keeps the task of this event run registered although the run is about to end without effects to wait for -- because the caller takes over and will continue it later.

claim-key identifies the claim and has to be unique among the claims of one task; an id the caller already holds per suspension does nicely. Give the same key back to release.

WATCHOUT: Whoever claims, releases -- in every outcome. A claim that is never given back leaves the task registered for good, and anything waiting for it waits for good. Where there is no run left to release in, an error path typically, there is the release-event.

Keeps the task of this event run registered although the run is about to
end without effects to wait for -- because the caller takes over and
will continue it later.

`claim-key` identifies the claim and has to be unique among the claims
of one task; an id the caller already holds per suspension does nicely.
Give the same key back to [[release]].

WATCHOUT: Whoever claims, releases -- in every outcome. A claim that is
never given back leaves the task registered for good, and anything waiting
for it waits for good. Where there is no run left to release in, an
error path typically, there is the [[release-event]].
sourceraw docstring

db-subcljs

re-frame subscription for ns db.

re-frame subscription for ns db.
sourceraw docstring

debouncecljs

(debounce ms)

Creates an interceptor to debounce event calls within ms.

To not debounce but call event add event vector meta ::debounce {:flush? true}.

Creates an interceptor to debounce event calls within `ms`.

To not debounce but call event add event vector meta `::debounce {:flush? true}`.
sourceraw docstring

dispatch-debounce!cljs

(dispatch-debounce! {:keys [ms] [event :as dispatch] :dispatch :as args})
source

dispatch-debounce-fxcljs

re-frame effect to debounce dispatch within ms.

re-frame effect to debounce `dispatch` within `ms`.
sourceraw docstring

ensure-original-eventcljs

(ensure-original-event event original-event)

Ensures an original-event for direct use or with task.

Ensures an `original-event` for direct use or with task.
sourceraw docstring

flush-debounce!cljs

(flush-debounce! {[event] :dispatch :as args})
source

flush-debounce-fxcljs

re-frame effect to flush debounced dispatch.

re-frame effect to flush debounced `dispatch`.
sourceraw docstring

get-original-eventcljs

(get-original-event event)

Gets original event of task event or event itself.

Gets original event of task event or `event` itself.
sourceraw docstring

get-taskcljs

(get-task db id-or-task)

Gets task in app-db via id-or-task. Can return nil.

Gets task in app-db via `id-or-task`. Can return nil.
sourceraw docstring

get-task-by-namecljs

(get-task-by-name db name)

Gets task in app-db via name. Can return nil.

Gets task in app-db via `name`. Can return nil.
sourceraw docstring

get-taskscljs

(get-tasks db)

Gets all tasks in app-db. Can return nil. Also see subscription tasks-sub.

Gets all tasks in app-db. Can return nil. Also see subscription [[tasks-sub]].
sourceraw docstring

reg-completion-keys-for-effectcljs

(reg-completion-keys-for-effect effect-key & completion-keys)

Registers effect completion keys to use with as-task.

Registers effect completion keys to use with `as-task`.
sourceraw docstring

registercljs

(register db {:keys [:jtk-dvlp.re-frame.tasks/id] :as task})

Registers task within app-db. Also see event register-event. Tasks can be used via subscriptions tasks-sub and running?-sub.

Registers task within app-db. Also see event [[register-event]].
Tasks can be used via subscriptions [[tasks-sub]] and [[running?-sub]].
sourceraw docstring

register-eventcljs

re-frame event to register task. See register.

re-frame event to register `task`. See [[register]].
sourceraw docstring

releasecljs

(release context claim-key)

Gives back a claim taken with claim, from within an event run. Use the release-event where there is no run to hand it back in.

Gives back a claim taken with [[claim]], from within an event run. Use the
[[release-event]] where there is no run to hand it back in.
sourceraw docstring

release-eventcljs

re-frame event to give back a claim outside of an event run, see claim. Completes the task when it was the last one.

re-frame event to give back a claim outside of an event run, see
[[claim]]. Completes the task when it was the last one.
sourceraw docstring

resumecljs

(resume event task-id)

Marks event as the continuation of the task task-id, so dispatching it picks that task up again instead of opening a second one. wait-for lets such an event past the very task it continues.

Marks `event` as the continuation of the task `task-id`, so dispatching
it picks that task up again instead of opening a second one. [[wait-for]]
lets such an event past the very task it continues.
sourceraw docstring

running?cljs

(running? db)
(running? db name)

Checks for running task in app-db also filtered via name. Also see subscription running?-sub.

Checks for running task in app-db also filtered via `name`. Also see
subscription [[running?-sub]].
sourceraw docstring

running?-subcljs

re-frame subscription for running tasks optional filtered by given name.

re-frame subscription for running tasks optional filtered by given `name`.
sourceraw docstring

some-original-event?cljs

(some-original-event? event)

Checks for some original event of task or event itself.

Checks for some original event of task or `event` itself.
sourceraw docstring

task-event?cljs

(task-event? event)

Checks if event is task based.

Checks if event is task based.
sourceraw docstring

task-idcljs

(task-id context)

Id of the task this event run belongs to, or nil when the run carries none. Hand it to whatever will continue the run later, see resume.

Id of the task this event run belongs to, or nil when the run carries
none. Hand it to whatever will continue the run later, see [[resume]].
sourceraw docstring

tasks-subcljs

re-frame subscription for all tasks.

re-frame subscription for all tasks.
sourceraw docstring

unregistercljs

(unregister db id-or-task)

Unregisters task within app-db. Also see event unregister-event. Tasks can be used via subscriptions tasks-sub and running?-sub.

WATCHOUT: This drops the task including its ::after-events; calling the events is up to the caller. Everything here goes through complete-task, which does both. Whoever calls this one directly has to dispatch the events, or whatever waited on the task waits for good, and nothing says a word.

Unregisters task within app-db. Also see event [[unregister-event]].
Tasks can be used via subscriptions [[tasks-sub]] and [[running?-sub]].

WATCHOUT: This drops the task including its `::after-events`; calling
the events is up to the caller. Everything here goes through
`complete-task`, which does both. Whoever calls this one directly has to
dispatch the events, or whatever waited on the task waits for good, and
nothing says a word.
sourceraw docstring

unregister-eventcljs

re-frame event to unregister task. See unregister.

re-frame event to unregister `task`. See [[unregister]].
sourceraw docstring

update-original-eventcljs

(update-original-event event f & args)

Updates original event of maybe task event, returns maybe modified event.

Updates original event of maybe task `event`, returns maybe modified `event`.
sourceraw docstring

wait-forcljs

(wait-for)
(wait-for tasks)
(wait-for tasks debounce-ms)

Creates an interceptor to wait for task aka. queue event execution during running tasks. tasks can be

  • :any for any task
  • a task name
  • a collection of task names
  • a 2-argument function given coeffects and all running tasks to filter for blocking tasks

Can be injected multiple times, consider injection order. Can be used as global interceptor, consider there is no direct reversal allow / pass functionality. To not wait for tasks but call event add event vector meta ::wait-for {:ignore-tasks #{task-name ,,,}}.

Sugar debounce-ms to also inject debounce interceptor.

Creates an interceptor to wait for task aka. queue event execution during running `tasks`.
`tasks` can be
- `:any` for any task
- a task name
- a collection of task names
- a 2-argument function given coeffects and all running tasks to filter for blocking tasks

Can be injected multiple times, consider injection order.
Can be used as global interceptor, consider there is no direct reversal allow / pass
functionality. To not wait for tasks but call event add event vector meta
`::wait-for {:ignore-tasks #{task-name ,,,}}`.

Sugar `debounce-ms` to also inject [[debounce]] interceptor.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close