Created
September 21, 2011 17:46
-
-
Save etgryphon/1232775 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 myStatechart = Statechart.create(); | |
myStatechart.addState("#application", { | |
initialSubstate: "#subapplication", | |
enterState: function() { | |
}, | |
exitState: function() { | |
}, | |
ready: function() { | |
console.log("application ready"); | |
} | |
}); | |
myStatechart.addState("#subapplication", { | |
parentState: "#application", | |
substatesAreConcurrent: true, | |
enterState: function() { | |
}, | |
exitState: function() { | |
}, | |
ready: function() { | |
console.log("subapplication ready"); | |
} | |
}); | |
myStatechart.addState("#sellers", { | |
parentState: "#subapplication", | |
enterState: function() { | |
this.sendEvent("ready"); | |
}, | |
exitState: function() { | |
}, | |
ready: function() { | |
console.log("sellers ready"); | |
return true; // ************ This will STOP the event chaining | |
} | |
}); | |
myStatechart.addState("#items", { | |
parentState: "#subapplication", | |
enterState: function() { | |
}, | |
exitState: function() { | |
} | |
}); | |
myStatechart.initStates("#application"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment