Functions for using reacl-c within a browser application.
Functions for using reacl-c within a browser application.
(execute-effects item & [options])
Returns an item that will intercept and execute all effects
emitted by the given item
. This is automatically wrapped around
the toplevel item when using run
, but not when
using run-controlled
.
Options can be a map with the following settings:
:recursion-limit
When effects continue to return new effects, an exception is thrown when this limit is reached (defaults to 1000),:monitor
A function called with the effect, its result value and a reacl-c.core/return
value of actions and messages emitted by that effect.Returns an item that will intercept and execute all effects emitted by the given `item`. This is automatically wrapped around the toplevel item when using [[run]], but not when using [[run-controlled]]. Options can be a map with the following settings: - `:recursion-limit` When effects continue to return new effects, an exception is thrown when this limit is reached (defaults to 1000), - `:monitor` A function called with the effect, its result value and a [[reacl-c.core/return]] value of actions and messages emitted by that effect.
(flush-sync! thunk)
Calls thunk and returns its result, and flushes changes to states causing a synchronous rerendering.
Calls thunk and returns its result, and flushes changes to states causing a synchronous rerendering.
(root dom)
Sets up the given dom node to render item. Returns an object which can
be passed to run
.
Sets up the given dom node to render item. Returns an object which can be passed to [[run]].
(run dom-or-root item & [options])
Runs the given item underneath the given native dom
node or root
,
automatically managing its state and executing effect actions.
Options are:
:initial-state
: specifying the initial state of the item, which defaults to nil.
:handle-action!
: a function called when the item emits an
action (excluding effects); if not specified, and the item does emit
an action, an error is thrown.
Runs the given item underneath the given native `dom` node or [[root]], automatically managing its state and executing effect actions. Options are: `:initial-state`: specifying the initial state of the item, which defaults to nil. `:handle-action!`: a function called when the item emits an action (excluding effects); if not specified, and the item does emit an action, an error is thrown.
(run-controlled dom-or-root item & [options])
Runs the given item underneath the given native dom
node or root
.
Options are:
:state
: specifying the state of the item, which defaults to nil.
set-state!
: a function that should handle a state change of the
item; if not specified, and the item wants to change its state, an
error is thrown.
handle-action!
: a function called when the item emits an
action (including effects); if not specified, and the item does emit
an action, an error is thrown.
Runs the given item underneath the given native `dom` node or [[root]]. Options are: `:state`: specifying the state of the item, which defaults to nil. `set-state!`: a function that should handle a state change of the item; if not specified, and the item wants to change its state, an error is thrown. `handle-action!`: a function called when the item emits an action (including effects); if not specified, and the item does emit an action, an error is thrown.
(send-message! app msg)
Sends a message to a running item, i.e. app
must be the value
returned from run
or run-controlled
. This can be used together
with reacl-c.core/handle-message
in situations where the
application is not running standalone, but integrated in a different
framework.
Sends a message to a running item, i.e. `app` must be the value returned from [[run]] or [[run-controlled]]. This can be used together with [[reacl-c.core/handle-message]] in situations where the application is not running standalone, but integrated in a different framework.
(stop! app)
Stops the given application (the value returned by root
, run
or run-controlled
, removing all DOM nodes rendered by it.
Stops the given application (the value returned by [[root]], [[run]] or [[run-controlled]], removing all DOM nodes rendered by it.
(transition! thunk)
Calls thunk and returns its result, and changes to states made during this call are handled with lower priority.
Calls thunk and returns its result, and changes to states made during this call are handled with lower priority.
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |