Created
March 11, 2013 21:25
-
-
Save joelhooks/5137906 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var machine = { | |
initial: 'state/STARTING', | |
states: [ | |
{ | |
name: 'state/STARTING', | |
transitions: [ | |
{ | |
action: 'action/completed/STARTED', | |
target: 'state/CONSTRUCTING' //name of the state to move to when event received | |
}, | |
{ | |
action: 'action/START_FAILED', | |
target: 'state/FAILING' | |
} | |
] | |
}, | |
{ | |
name: 'state/CONSTRUCTING', | |
changed: 'event/CONSTRUCT', | |
exiting: 'event/CONSTRUCTION_EXIT', | |
entering: 'action/CONSTRUCTION_ENTERING', | |
transitions: [ | |
{ | |
action: 'action/completed/CONSTRUCTED', //action is the event constant | |
target: 'NAVIGATING' //name of the state to move to when event received | |
}, | |
{ | |
action: 'action/CONSTRUCTION_FAILED', | |
target: 'FAILING' | |
} | |
] | |
}, | |
{ | |
name: 'state/NAVIGATING', | |
changed: 'event/NAVIGATE' | |
//no transitions because this is effectively the end of the road | |
}, | |
{ | |
name: 'state/FAILING', | |
changed: 'event/FAIL' | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment