项目作者: icetemple

项目描述 :
Simple finite state machine
高级语言: TypeScript
项目地址: git://github.com/icetemple/npm-it-fsm.git
创建时间: 2019-10-11T07:54:06Z
项目社区:https://github.com/icetemple/npm-it-fsm

开源协议:MIT License

下载


IT FSM

ci
Coverage Status

Simple full-featured finite state machine for your project

Why it-fsm?

  • 🚯 333 LOC - 0 dependencies
  • 🍒 Sophisticated object-oriented design

Getting started

  1. import { StateMachineBuilder } from "it-fsm";
  2. const [locked, unlocked] = ["locked", "unlocked"] as const;
  3. const sm = new StateMachineBuilder()
  4. .withStates([locked, unlocked])
  5. .withTransitions([
  6. [locked, { coin: unlocked }],
  7. [unlocked, { push: locked }],
  8. ])
  9. .build(locked);

You can find more examples here

Installation

Deno

if you use the Deno, just add the following to your
import_map.json

  1. {
  2. "imports": {
  3. "it-fsm": "https://git.pleshevski.ru/pleshevskiy/it-fsm/raw/tag/v2.0.3/fsm.ts"
  4. }
  5. }

Node.js

If you use the Node.js or in a browser as ES module, you may need to install it
as follows, and additionally you can add import maps for client side.

npm install --save it-fsm

License

GNU General Public License v3.0 or later

See COPYING to see the full text.