Adding & removing transitions

This example demonstrates adding and removing transitions on-the-fly, and handling subsequent events to update the UI.

The syntax for adding transitions is as follows:

fsm.add('next', 'a', 'b'); // longhand
fsm.add('next : a > b');   // shorthand

Currently, only states can be removed:

fsm.remove('a');           // state only

Upon removal of a state, any orphaned actions or states are also removed.

Upon addition or removal of states or actions, a StateEvent or ActionEvent is dispatched, the value property of which can be used to determine the state or action in question.

Use the following event handler ids to listen to these events:


As you can see above, using these event handlers, it's possible to easily update any system on the fly.