Vue reactive state

State A
State B
State C
State D
(asynchronous)
State E

Vue's reactivity system works fundamentally differently to JavaScript's event system so uses a helper class to bridge the gap.

This example uses StateMachine and StateHelper to show how your Vue JS apps can benefit from state management:

If you look at the JavaScript, you'll see the following line:

this.state = StateMachine.helper(this.fsm).data

This creates the helper and immediately shares its data property to application's state property:

{
  "name": "a",
  "index": 0,
  "paused": false,
  "is": {
    "a": true
  },
  "actions": {
    "next": true
  },
  "states": {
    "b": true
  },
  "all": {
    "states": [
      "a",
      "b",
      "c",
      "d",
      "e"
    ],
    "actions": [
      "next",
      "back"
    ]
  }
}

If you look at the rest of the code, there is very little JavaScript needed, with all of the below driven by changes in app.state:

Menu