Skip to content

coroutine/fsm-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fsm.js

A finite state machine written in CoffeeScript

Example

fsm = new FSM( states: ["asleep", "awake", "standing", "sitting"], initialState: "asleep" )

# We can transition from one or many states, but we can only transition to one state.
fsm.event("shake",        transition: { from: "asleep", to: "awake" })
   .event("sleeperHold",  transition: { from: ["awake", "standing", "sitting"], to: "asleep" })
   .before("shake",       -> console.log("wake up, Jack!"))
   .after("sleeperHold",  -> console.log("..."))

About

A finite state machine written in CoffeeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published