Liking cljdoc? Tell your friends :D

drbuchkov.re-xstate.core


actor-send!cljs

(actor-send! [actor message])

Sends message to xstate actor

Sends message to xstate actor
sourceraw docstring

actor-start!cljs

(actor-start! {:keys [actor]})

Starts xstate actor.

Starts xstate actor.
sourceraw docstring

actor-stop!cljs

(actor-stop! actor)

Stops xstate actor.

Stops xstate actor.
sourceraw docstring

actor-subscribe!cljs

(actor-subscribe! {:keys [actor] {:keys [id]} :config})

Adds a listener to the actor to listen to state changes.

Adds a listener to the actor to listen to state changes.
sourceraw docstring

evt->edncljs

(evt->edn evt)

Converts the xstate event object to edn.

Converts the xstate event object to edn.
sourceraw docstring

get-fsmcljs

(get-fsm db [_ fsm-id])

Returns the FSM by id from db.

Returns the FSM by id from db.
sourceraw docstring

get-fsm-actorcljs

(get-fsm-actor db [_ fsm-id])

Returns the xstate actor of the FSM from db.

Returns the xstate actor of the FSM from db.
sourceraw docstring

get-fsm-configcljs

(get-fsm-config db [_ fsm-id])

Returns the config of the FSM from db.

Returns the config of the FSM from db.
sourceraw docstring

get-fsm-contextcljs

(get-fsm-context db [_ fsm-id])

Returns the context of the FSM from db.

Returns the context of the FSM from db.
sourceraw docstring

get-fsm-machinecljs

(get-fsm-machine db [_ fsm-id])

Returns the xstate machine of the FSM from db.

Returns the xstate machine of the FSM from db.
sourceraw docstring

get-fsm-statecljs

(get-fsm-state db [_ fsm-id])

Returns the current state as a js object (returned by XState) of the FSM from db.

Returns the current state as a js object (returned by XState) of the FSM from db.
sourceraw docstring

get-fsm-state-mapcljs

(get-fsm-state-map db [_ fsm-id])

Returns the current state as a clojure map from db.

Returns the current state as a clojure map from db.
sourceraw docstring

initialize-fsmcljs

(initialize-fsm {:keys [db]} [{:keys [id context] :as fsm-config} fsm-options])

Initializes the FSM and updates the db with the FSM map.

Initializes the FSM and updates the db with the FSM map.
sourceraw docstring

normalize-actionscljs

(normalize-actions actions)

Normalizes the actions by converting the type to a keyword.

Normalizes the actions by converting the type to a keyword.
sourceraw docstring

on-statecljs

(on-state fsm-id)

Xstate actor subscribe listener, dispatches ::update-state event

Xstate actor subscribe listener, dispatches `::update-state` event
sourceraw docstring

run-effectful-action!cljs

(run-effectful-action! [effect evt])

Runs the effectful action function, given the event.

Runs the effectful action function, given the event.
sourceraw docstring

sendcljs

(send {:keys [db]} [fsm-id {:keys [type] :as message}])

Dispatches an effect to send a message to a xstate actor. fsm-id, transition-actions and ctx are injected to the message.

Dispatches an effect to send a message to a xstate actor.
`fsm-id`, `transition-actions` and `ctx` are injected to the message.
sourceraw docstring

transitioncljs

(transition db [_ fsm-id state message])

Returns the new state given app-db, fsm-id, current state, and message

Returns the new state given app-db, fsm-id, current state, and message
sourceraw docstring

transition-paramscljs

(transition-params action-id transition-actions)

Returns the params for the given action-id in the transition-actions property that's injected from the send event into the message.

Returns the params for the given action-id in the transition-actions property that's injected from
the `send` event into the message.
sourceraw docstring

update-contextcljs

(update-context {:keys [db]} [{:keys [fsm-id] :as evt} action-fn])

Given a ctx-action function and an event, updates the context of the FSM in the db. This is used instead of the default xstate context updating, because the default xstate context updating doesn't work with re-frame subscriptions, and converting from edn to json and back results in a loss of data.

Given a ctx-action function and an event, updates the context of the FSM in the db.
This is used instead of the default xstate context updating, because the default xstate context updating
doesn't work with re-frame subscriptions, and converting from edn to json and back results in a loss of data.
sourceraw docstring

update-statecljs

(update-state {:keys [db]} [fsm-id state])

Updates the state of the FSM in the db. Dispatches action events on transition if any.

Updates the state of the FSM in the db.
Dispatches action events on transition if any.
sourceraw docstring

wrap-ctx-actioncljs

(wrap-ctx-action action-fn)

Given a context action function, returns a 2-arity callback that can be used as an xstate action. The event is converted to edn before being passed to the action function.

Given a context action function, returns a 2-arity callback that can be used as an xstate action.
The event is converted to edn before being passed to the action function.
sourceraw docstring

wrap-effectful-actioncljs

(wrap-effectful-action action-fn)

Given an effectful action function, returns a 2-arity callback that can be used as an xstate action. The event is converted to edn before being passed to the action function.

Given an effectful action function, returns a 2-arity callback that can be used as an xstate action.
The event is converted to edn before being passed to the action function.
sourceraw docstring

wrap-guardcljs

(wrap-guard guard-fn)

Given a function that takes an event and returns a boolean, returns a 2-arity callback that can be used as an xstate guard. The event is converted to edn before being passed to the guard function.

Given a function that takes an event and returns a boolean, returns a 2-arity callback that can be used as an xstate guard.
The event is converted to edn before being passed to the guard function.
sourceraw docstring

xstate-state->cljcljs

(xstate-state->clj state)

Returns the xstate state object as a clojure map.

Returns the xstate state object as a clojure map.
sourceraw docstring

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

× close