xevo-fsm

Finite Stat Machine component for xevo projects

Usage no npm install needed!

<script type="module">
  import xevoFsm from 'https://cdn.skypack.dev/xevo-fsm';
</script>

README

Overview

This is a Finite State Machine component for xevo projects.

Installation

npm install --save xevo-fsm

Usage

Simplest use case is to build a runner directly

import {Fsm} from "xevo-fsm"

let fsm = Fsm.builder()
     .addTransition("Ping", "beat", "Pong")
     .addTransition("Pong", "beat", "Ping")
     .buildRunner();

console.log(fsm.currentState); // Ping
fsm.event("beat")
console.log(fsm.currentState); // Pong
fsm.event("beat")
console.log(fsm.currentState); // Ping