etgryphon/stativus — pull request #84 by joshholt (2013-07-30 15:57:43+00:00)
Title: Stativus Event Handling and a smaller lib

If you have included jQuery on your page with Stativus and you have defined either an "actions" or "events" object in any of your states, then events will be fired against the state chart as a result of the DOM event.

// An example of the actions/events object on a state
MyApp.stateX = {
events: {
'click .foo' : 'bar',
'keypress .bar' : 'fooBar',
'mouseup': 'closeModal'
}
};

In the above example, a click event is bound to elements that contain the 'foo' class and fire the event 'bar' in your statechart. Again a key press event is bound to the elements that contain the 'bar' class and fire the 'fooBar' event in your statechart. If you want to bind an event to the document (ex. to close modals) then you will just use the third event definition as an example.