fsm-spec Pub

A simple Finite State Machine example - implementation

$when:: fsm1.init (id)
   . (status="init")

$when:: fsm1.move
   . (status=((status + "-") + to))

$when:: fsm1.reset
   . (status="")

This works because the context is maintained for the duration of the story. This FSM would not maintain the state across stories, for instance... see below.


TODO i can't persist this because now it won't reset

//$when fsm1.*(id) => ctx.persisted(kind="fsm1", id=id)

TODO implement a better FSM with persistence across stories


Was this useful?    

By: Razie | 2016-06-26 .. 2016-07-21 | Tags: spec , dsl


Viewed 103 times ( | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2020, all rights reserved.