I want to define concurrent states in Ember.js, but the lack of documentation makes it hard to figure out how.
You can define mutually exclusive states (system is either in foo
or bar
) like so:
App.stateManager = Ember.StateManager.create({
foo: Ember.State.create({
//...
}),
bar: Ember.State.create({
//...
})
});
EDIT: Response to ud3323
Isn't the following concurrent states?
App.stateManager = Ember.StateManager.create({
foo_baz: Ember.State.create({
foo: Ember.State.create({
// ...
}),
baz: Ember.State.create({
// ...
})
}),
bar: Ember.State.create({
//...
})
});
But how do you define concurrent states such that, for example, when the system is in foo
state, it is also in baz
state.
For concurrent states you need to use the statechart add-on. Concurrency is not implemented into enber-states as of yet...
edit
Concurrent states === orthogonal regions (in the world of uml state machine design)
Sorry for not making that clear.