PicoMachine

0.0.1 • Public • Published

PicoMachine

a.k.a.: MicroMachine for javascript

Description

PicoMachine is a javascript version of MicroMachine and have the same goals. To be a minimal and fully functional minimal state machine.

Usage

var PicoMachine = require('picomachine');

var machine = PicoMachine.new('new'); // Initial state.

machine.transitionsFor['confirm'] = { new: 'confirmed' };
machine.transitionsFor['ignore']  = { new: 'ignored' };
machine.transitionsFor['reset']   = { confirmed: 'new', ignored: 'new' };

machine.trigger('confirm');  // true
machine.trigger('ignore');   // false
machine.trigger('reset');    // true
machine.trigger('ignore');   // true

Readme

Keywords

none

Package Sidebar

Install

npm i PicoMachine

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • elcuervo