Liking cljdoc? Tell your friends :D

com.fulcrologic.statecharts.simple

Functions that set up the simplest version of a state chart that uses the v20150901 implementation (version), a working memory data model, CLJC execution support, and an event queue that requires manual polling.

Functions that set up the simplest version of a state chart that uses the v20150901
implementation (version), a working memory data model,
CLJC execution support, and an event queue that requires manual polling.
raw docstring

register!clj/s

(register! {:com.fulcrologic.statecharts/keys [statechart-registry]}
           chart-key
           chart)

Register a statechart chart at chart-key in the registry known by env.

Register a statechart `chart` at `chart-key` in the registry known by `env`.
sourceraw docstring

send!clj/s

(send! {:com.fulcrologic.statecharts/keys [event-queue] :as env} event)

Proxy to sp/send! on the event-queue in env.

Proxy to sp/send! on the event-queue in `env`.
sourceraw docstring

simple-envclj/s

(simple-env)
(simple-env {:com.fulcrologic.statecharts/keys [data-model execution-model
                                                event-queue working-memory-store
                                                statechart-registry]
             :as extra-env})

Creates an env that has a local and simple implementation of all required components.

It defaults to standard processing with a flat working memory data model, a manual event queue, local memory registry and memory storage, a statechart invocation processor, the lambda executor, and a v20150901 processor.

extra-env can contain anything extra you want in env, and can override any of the above by key (e.g. ::sc/data-model).

Returns an env ready to be used with the processor (which is ::sc/processor in env).

Remember to register your charts via (env/register! env k chart) or by using the ::sc/statechart-registry returned in env directly.

(def env (simple-env))
(env/register! env ::chart some-chart)
(def processor (::sc/processor env))
(def s0 (sp/start! processor env ::chart {::sc/session-id 42}))
(def s1 (sp/process-event! processor env s0 event))
...
Creates an env that has a local and simple implementation of all required components.

It defaults to standard processing with a flat working memory data model, a manual event queue,
local memory registry and memory storage, a statechart invocation processor,
the lambda executor, and a v20150901 processor.

`extra-env` can contain anything extra you want in `env`, and can override any of the above by
key (e.g. ::sc/data-model).

Returns an `env` ready to be used with the processor (which is ::sc/processor in `env`).

Remember to register your charts via `(env/register! env k chart)` or by using the
::sc/statechart-registry returned in `env` directly.

```
(def env (simple-env))
(env/register! env ::chart some-chart)
(def processor (::sc/processor env))
(def s0 (sp/start! processor env ::chart {::sc/session-id 42}))
(def s1 (sp/process-event! processor env s0 event))
...
```
sourceraw docstring

start!clj/s

(start! env chart-src)
(start! {:com.fulcrologic.statecharts/keys [processor working-memory-store
                                            statechart-registry]
         :as env}
        chart-src
        session-id)

Start a statechart that has been previously registered with env as chart-src. The options map can contain ::sc/session-id or one will be autogenerated. Note: This assumes you're going to send events via the event queue, and that something is running an event loop on that event queue.

Returns nothing useful, but throws if there is a problem.

Start a statechart that has been previously registered with `env` as `chart-src`. The options map
can contain ::sc/session-id or one will be autogenerated. Note: This assumes you're going to send events
via the event queue, and that something is running an event loop on that event queue.

Returns nothing useful, but throws if there is a problem.
sourceraw docstring

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

× close