3.0.0 • Published 2 years ago

async-fsm.js v3.0.0

Weekly downloads
17
License
MIT
Repository
-
Last release
2 years ago

async-fsm.js

Commitizen friendly

a finite state machine implementation

Quick Start

npm i async-fsm.js

Test

npm run test

Features

  • asynchronous onEnter, onLeave hooks
  • asynchronous check if operation is available
  • available operations
  • comprehensive error checking

Example

const { Fsm } = require('async-fsm.js')
const fsm = new Fsm()
  .addState(new State("started")
    .routes({
      finish: "ended",
    })
  )
  .addState("ended");

const fsmInstance = fsm.createInstance("started").bundle({ foo: "abc" });
await fsmInstance.perform('finish');
expect(fsmInstance.state.name).toBe('ended');

please check test for more examples.

3.0.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.6.0

3 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

0.1.1

7 years ago