Closed sebpiq closed 12 years ago
for example this could simplify the following case :
MyView = StatefulView.extend({
events: {'click': 'clickedCallback'},
states: {idle: {}, focused: {}},
transitions: {
idle: {focus: {enterState: 'focused'}},
focused: {blur: {enterState: 'idle'}}
},
currentState: 'idle',
clickedCallback: function() {
this.receive('focus');
}
});
Where the sole purpose of the callback is to trigger a state-machine event when click
event received. Cool thing would be :
MyView = StatefulView.extend({
states: {idle: {}, focused: {}},
transitions: {
idle: {click: {enterState: 'focused'}},
focused: {blur: {enterState: 'idle'}}
},
currentState: 'idle',
});
Events could also be event selectors as in Backbone.Events
:
MyView = StatefulView.extend({
states: {idle: {}, focused: {}},
transitions: {
idle: {'click .aSpecialDiv': {enterState: 'focused'}},
focused: {blur: {enterState: 'idle'}}
},
currentState: 'idle',
});
all fixed
Right now there is separation between state machine events and backbone events (e.g. triggering a state machine event with 'receive') ... there shouldn't be.