(collect-actions item atom)
Returns an item that is like item
, but will capture all emitted actions and
conj them into the given atom instead.
Returns an item that is like `item`, but will capture all emitted actions and conj them into the given atom instead.
(disable-subscriptions item)
(disable-subscriptions item subs)
Returns an item like item
, but where all subscriptions (or the
the given subscriptions) are not executed when emitted from item
.
Returns an item like `item`, but where all subscriptions (or the the given subscriptions) are not executed when emitted from `item`.
(effect-args eff)
Returns the arguments for the function returned by effect-f
.
Returns the arguments for the function returned by [[effect-f]].
(effect-f eff)
Returns the function implementing the effect behind the given simple effect action. See simple-effect?
.
Returns the function implementing the effect behind the given simple effect action. See [[simple-effect?]].
(effect? a & [eff-defn])
Returns true if the given action is an effect action, and optionally if it was created by the given effect function.
Returns true if the given action is an effect action, and optionally if it was created by the given effect function.
(emulate-subscriptions item f)
Returns an item, that for all subscriptions done in item
,
evaluates (f subscription-effect)
. The
function [[subscription-effect?]] can be used to check which kind of
subscription effect it is. If it evaluates to nil
or the same
effect that was passed in, it is just passed on. If it evaluates to
a different action, that action is emitted from the subscription
itself, i.e. emulating a (synchronous) result of the subscription.
Returns an item, that for all subscriptions done in `item`, evaluates `(f subscription-effect)`. The function [[subscription-effect?]] can be used to check which kind of subscription effect it is. If it evaluates to `nil` or the same effect that was passed in, it is just passed on. If it evaluates to a different action, that action is emitted from the subscription itself, i.e. emulating a (synchronous) result of the subscription.
(map-subscriptions item f)
Returns an item that replaces subscriptions in item
. Note that
item
itself remains unchanged; instead, whenever a subscription is
activated in item
, f
will be called with that subscription, and
if it returns a different subscription, then that is activated
instead. If it returns nil, then the original subscription will be
actived.
You can use subscription?
and subscription-args
, if the
replacement depends on details of the subscription or for mapping a
whole group of subscriptions.
Returns an item that replaces subscriptions in `item`. Note that `item` itself remains unchanged; instead, whenever a subscription is activated in `item`, `f` will be called with that subscription, and if it returns a different subscription, then that is activated instead. If it returns nil, then the original subscription will be actived. You can use [[subscription?]] and [[subscription-args]], if the replacement depends on details of the subscription or for mapping a whole group of subscriptions.
(preventing-error-log thunk)
Prevents a log message about an exception during the evaluation of
thunk
, which occurs even when the error is handled in an error
boundary. If thunk
returns a promise, then error logs are enabled
after that completes instead.
Prevents a log message about an exception during the evaluation of `thunk`, which occurs even when the error is handled in an error boundary. If `thunk` returns a promise, then error logs are enabled after that completes instead.
(provided bindings & body)
Replaces the values bound to the given vars during the
evaluation of body
, and sets them back to the previous values
afterwards. Example:
(def x 42)
(provided [x 11]
(is (= (* x 2) 22)))
(is (= x 42))
Replaces the values bound to the given vars during the evaluation of `body`, and sets them back to the previous values afterwards. Example: ``` (def x 42) (provided [x 11] (is (= (* x 2) 22))) (is (= x 42)) ```
(run-effect! eff)
Returns a tuple [value ret]
. If an effect returns a reacl-c.core/return
value, then 'value' is the returned state, and 'ret' everything else.
For any other value, 'ret' is empty.
Returns a tuple `[value ret]`. If an effect returns a [[reacl-c.core/return]] value, then 'value' is the returned state, and 'ret' everything else. For any other value, 'ret' is empty.
(run-subscription! sub deliver!)
Calls the function implementing the given subscription with the given
deliver!
function, returning the stop function for it.
Calls the function implementing the given subscription with the given `deliver!` function, returning the stop function for it.
(simple-effect? a & [eff-defn])
Returns true for effects created by [[core/effect]] or [[core/defn-effect]], but false for those created from [[core/seq-effects]].
Returns true for effects created by [[core/effect]] or [[core/defn-effect]], but false for those created from [[core/seq-effects]].
(subscribe-effect-args eff)
The arguments passed to the subscription the given subscribe effect was generated from.
The arguments passed to the subscription the given subscribe effect was generated from.
(subscribe-effect-fn eff)
The function passed to the subscription the given subscribe effect was generated from.
The function passed to the subscription the given subscribe effect was generated from.
(subscribe-effect? eff)
(subscribe-effect? eff subs)
Tests if the given effect, is one that is emitted by a subscription equal to the given one on mount. This can be useful in unit tests.
Tests if the given effect, is one that is emitted by a subscription equal to the given one on mount. This can be useful in unit tests.
(subscription-args sub)
Returns extra arguments for the function implementing the given subscription item. See subscription-f
Returns extra arguments for the function implementing the given subscription item. See [[subscription-f]]
(subscription-f sub)
Returns the function implementing the given subscription item.
Returns the function implementing the given subscription item.
(subscription-results sub num-actions & [timeout-ms])
Runs the given subscription, asynchronously waiting for at least the given number of actions emitted by it (or the given timeout elapses), and then stops the subscription. Returns a promise of the sequence of actions.
Runs the given subscription, asynchronously waiting for at least the given number of actions emitted by it (or the given timeout elapses), and then stops the subscription. Returns a promise of the sequence of actions.
(subscription? v)
(subscription? v f)
Returns whether item
is a subscription item, optinally also
checking if it was created by the given defn-subscription
function
or with the given function f
as its implementation.
Returns whether `item` is a subscription item, optinally also checking if it was created by the given `defn-subscription` function or with the given function `f` as its implementation.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close