Skip to content

Instantly share code, notes, and snippets.

@hlfcoding
Created February 4, 2015 19:35
Show Gist options
  • Save hlfcoding/f5b4ae1f4c2256eaeb42 to your computer and use it in GitHub Desktop.
Save hlfcoding/f5b4ae1f4c2256eaeb42 to your computer and use it in GitHub Desktop.
StateMachine
  • StateMachine
    • #constructor
      • should allow setting initialState
      • should allow registering State's
      • should allow registering Transition's, and a fallback Transition
    • #switchState
      • should allow switch between available State's
      • should perform a transition before calling #onEnter on new state
      • should return a promise, done or fail
      • should emit an event, done or fail
    • [eventHub]
  • State
    • #name
    • #can
      • should be called before entering state
      • should be passed the current state's name
      • should return a promise
    • #onEnter
      • should be called on entering state
      • should be passed the previous state's name
      • should return a promise
    • #onExit
      • should be called on exiting state
      • should be passed the next state's name
      • should return a promise
    • #rollBack
      • should allow undoing exit procedure, in case transition failed
      • should be passed the next state's name
      • should return a promise
  • Transition
    • #perform
      • should be passed the source and destination state names
      • should return a promise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment