You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
Version 2.1.0 (January 7th 2012)
2
2
--------------------------------
3
3
4
+
* Allow event to be cancelled by returning `false` from `onleavestate` handler (issue #13) - WARNING: this breaks backward compatibility for async transitions (you now need to return `StateMachine.ASYNC` instead of `false`)
4
5
* Added explicit return values for event methods (issue #12)
5
6
* Added support for wildcard events that can be fired 'from' any state (issue #11)
6
7
* Added support for no-op events that transition 'to' the same state (issue #5)
this.transition=function(){// prepare transition method for use either lower down, or by caller if they want an async transition (indicated by a false return value from leaveState)
112
-
fsm.transition=null;// this method should only ever be called once
if(this.transition)// in case user manually called it but forgot to return false
122
-
returnthis.transition();
123
-
}
124
-
125
-
returnStateMachine.ASYNC;// transition method took care of (or, if async, will take care of) the afterEvent, DONT fall through
109
+
if(from===to){
110
+
StateMachine.afterEvent(this,name,from,to,args);
111
+
returnStateMachine.NOTRANSITION;
126
112
}
127
113
128
-
StateMachine.afterEvent(this,name,from,to,args);// this is only ever called if there was NO transition (e.g. if from === to)
114
+
// prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
115
+
varfsm=this;
116
+
this.transition=function(){
117
+
fsm.transition=null;// this method should only ever be called once
0 commit comments