backbone.statemachine.js
function(leaveState, event, data) {
        // If `data` is a string, it is the destination state of the transition
        if (_.isString(data)) data = {enterState: data}
        else data = _.clone(data)

        if (leaveState !== ANY_STATE && !this._states.hasOwnProperty(leaveState))
          this.state(leaveState, {})

        if (!this._states.hasOwnProperty(data.enterState))
          this.state(data.enterState, {})

        if (!this._transitions.hasOwnProperty(leaveState))
          this._transitions[leaveState] = {}

        data.callbacks = this._collectMethods((data.callbacks || []))
        this._transitions[leaveState][event] = data
      }
function(leaveState, event, data) {
        // If `data` is a string, it is the destination state of the transition
        if (_.isString(data)) data = {enterState: data}
        else data = _.clone(data)

        if (leaveState !== ANY_STATE && !this._states.hasOwnProperty(leaveState))
          this.state(leaveState, {})

        if (!this._states.hasOwnProperty(data.enterState))
          this.state(data.enterState, {})

        if (!this._transitions.hasOwnProperty(leaveState))
          this._transitions[leaveState] = {}

        data.callbacks = this._collectMethods((data.callbacks || []))
        this._transitions[leaveState][event] = data
      }
function ( leaveState , event , data ) { // If `data` is a string, it is the destination state of the transition if ( _ . isString ( data ) ) data = { enterState : data } else data = _ . clone ( data ) if ( leaveState !== ANY_STATE && ! this . _states . hasOwnProperty ( leaveState ) ) this . state ( leaveState , { } ) if ( ! this . _states . hasOwnProperty ( data . enterState ) ) this . state ( data . enterState , { } ) if ( ! this . _transitions . hasOwnProperty ( leaveState ) ) this . _transitions [ leaveState ] = { } data . callbacks = this . _collectMethods ( ( data . callbacks || [ ] ) ) this . _transitions [ leaveState ] [ event ] = data }
Declares a new transition on the state machine.
Declares a new transition on the state machine .