FrozenCanuck / Ki

A Statechart Framework for SproutCore
http://frozencanuck.wordpress.com
Other
105 stars 7 forks source link

gotoState(x) when x is the current state shouldn't do anything #35

Open williamcoates opened 12 years ago

williamcoates commented 12 years ago

I have a simple statechart used for authentication. It has one root state, with multiple substates such as 'loggedIn'.

If the statechart is currently in state 'loggedIn' and i call gotoState('loggedIn'), it runs exitState() and enterState() for the 'loggedIn' state, which seems like the wrong behaviour: if the statechart is already in that state it shouldn't run any state transitions!

This means that in our code, we always have to check that the current state isnt equal to the one we are transitioning to, in order not to run any superfluous transitions.