Skip to content

Instantly share code, notes, and snippets.

@johanvalcoog
Forked from joewest/gist:1483578
Created January 10, 2012 19:27
Show Gist options
  • Save johanvalcoog/1590662 to your computer and use it in GitHub Desktop.
Save johanvalcoog/1590662 to your computer and use it in GitHub Desktop.
ember.js concurrent substates?
var State = Ember.State.extend({});
var ViewState = Ember.ViewState.extend({});
// existing
App.statechart = Ember.StateManager.create({
loggedOut: ViewState.create({}),
loggingIn: ViewState.create({}),
loggedIn: Ember.StateManager.create({
appLoadFailed: ViewState.create({}),
appLoading: ViewState.create({}),
appLoaded: State.create({
enter: function() {
// start up substates
},
exit: function() {
// tear down substates
},
pushNotifications: Ember.StateManager.create({
pushDisconnected: State.create({}),
pushConnecting: State.create({}),
pushConnected: State.create({}),
}),
displayAppUI: State.create({
enter: function() {
// start up substates
},
exit: function() {
// tear down substates
},
displayUI: ViewState.create({}),
displayModals: Ember.StateManager.create({
displayNone: State.create({}),
displaySettings: ViewState.create({}),
displayWarning: ViewState.create({})
}),
backgroundQueue: Ember.StateManager.create({}),
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment