Created
October 15, 2011 15:13
-
-
Save joubertnel/1289689 to your computer and use it in GitHub Desktop.
Dynamic state transition from sibling states in a SproutCore state chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gotoStateFromFirstSiblingCurrentState: function(destinationState, commonParentState, defaultSourceState) { | |
var sourceState = this.get('currentStates').find(function(s) { | |
var isSibling = s.getPath('parentState.stateName') === commonParentState; | |
return isSibling; | |
}); | |
sourceState = sourceState || defaultSourceState; | |
this.gotoState(destinationState, sourceState); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment