1.0.0 • Published 1 year ago
@uictoria1/fsm v1.0.0
Getting started
import { fsm, transition } from "fsm";
const states = {
idle: transition("start", "starting"),
starting: transition("starting_done", "started"),
started: transition("stop", "stopping"),
stopping: transition("stopping_done", "idle"),
};
const fsm = createMachine(states);
// currentState = idle
fsm.dispatch("start");
const currentState = fsm.current;
// currentState = starting
fsm.dispatch("starting_done");
// currentState = started
1.0.0
1 year ago