Liking cljdoc? Tell your friends :D

com.fulcrologic.statecharts.convenience

ALPHA. NOT API STABLE.

This namespace includes functions and macros that emit statechart elements, but have a more concise notation for common cases that are normally a bit verbose.

Another purpose that is built into some of the macros is to make it more convenient to get clear diagram output when rendering the chart (TODO). The choice macro, for example, includes the conditional expressions as strigified notes on the nodes.

ALPHA. NOT API STABLE.

This namespace includes functions and macros that emit statechart elements, but have a more
concise notation for common cases that are normally a bit verbose.

Another purpose that is built into some of the macros is to make it more convenient to get clear diagram output
when rendering the chart (TODO). The `choice` macro, for example, includes the conditional expressions as
strigified notes on the nodes.
raw docstring

assign-onclj/s

(assign-on event location expression)

Creates a target-less transition that simply assigns the given expression to the data model at the given location when event happens.

Emits:

(transition {:event event}
  (assign {:location location :expr expression}))
Creates a target-less transition that simply assigns the given expression to the data model at
the given location when `event` happens.

Emits:

```
(transition {:event event}
  (assign {:location location :expr expression}))
```
sourceraw docstring

choiceclj/s

(choice props & args)

Create a choice state. Notation is like cond, but :else is the only acceptable "default" predicate. The pred should (fn [env data] boolean?). See also the choice macro in convenience-macros, which can include the expressions as annotations on the nodes.

(choice {:id node-id ...}
  pred  target-state
  pred2 target-state2
  :else else-target-state)

is exactly equivalent to:

(state {:id node-id :diagram/prototype :choice}
  (transition {:cond pred :target target-state})
  (transition {:cond pred2 :target target-state2})
  (transition {:target else-target-state})
Create a choice state. Notation is like `cond`, but `:else` is the only acceptable "default" predicate.
 The `pred` should `(fn [env data] boolean?)`. See also the `choice` macro in convenience-macros, which
 can include the expressions as annotations on the nodes.

```
(choice {:id node-id ...}
  pred  target-state
  pred2 target-state2
  :else else-target-state)
```

is exactly equivalent to:

```
(state {:id node-id :diagram/prototype :choice}
  (transition {:cond pred :target target-state})
  (transition {:cond pred2 :target target-state2})
  (transition {:target else-target-state})
```
sourceraw docstring

handleclj/s

(handle event expr)

Generate a target-less transition with an expression (script node). Basically an event handler.

Emits:

(transition {:event event}
  (script {:expr expr}))
Generate a target-less transition with an expression (script node). Basically an event handler.

Emits:

```
(transition {:event event}
  (script {:expr expr}))
```
sourceraw docstring

onclj/s

(on event target & actions)

Shorthand for (transition {:event event :target target} ...actions)

Shorthand for `(transition {:event event :target target} ...actions)`
sourceraw docstring

send-afterclj/s

(send-after {:keys [id delay delayexpr] :as send-props})

Creates a pair of elements: an on-entry and on-exit, which send an event after some delay (see send for delay/delayexpr), but cancel that event if the enclosing state is exited. The argument is the props for a send element, which MUST include an :id (currently does not support idlocation).

If you don't specify a delay it won't technically break the entry, but the extra exit will be cruft.

Emits:

[(on-entry {}
   (Send send-props))
 (on-exit {}
   (cancel {:sendid id}))]
Creates a pair of elements: an on-entry and on-exit, which send an event after some delay (see `send` for delay/delayexpr),
but cancel that event if the enclosing state is exited. The argument is the props for a `send` element, which MUST
include an `:id` (currently does not support idlocation).

If you don't specify a delay it won't technically break the entry, but the extra exit will be cruft.

Emits:

```
[(on-entry {}
   (Send send-props))
 (on-exit {}
   (cancel {:sendid id}))]
```
sourceraw docstring

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

× close