Skip to content

Commit acc93f2

Browse files
committed
Merge branch 'master' of https://github.com/Ben305/javascript-state-machine into Ben305-master
2 parents a5ed2dc + a48dd9d commit acc93f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

state-machine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
7979
fsm.can = function(event) { return !this.transition && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
8080
fsm.cannot = function(event) { return !this.can(event); };
81-
fsm.transitions = function() { return transitions[this.current]; };
81+
fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD]); };
8282
fsm.isFinished = function() { return this.is(terminal); };
8383
fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17)
8484

0 commit comments

Comments
 (0)