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 = ; var machine = 'new'; // Initial state. machinetransitionsFor'confirm' = new: 'confirmed' ;machinetransitionsFor'ignore' = new: 'ignored' ;machinetransitionsFor'reset' = confirmed: 'new' ignored: 'new' ; machine; // truemachine; // falsemachine; // truemachine; // true
Callbacks
machine; // Callback for the 'confirm' eventmachine; // Callback for all the things!machine; machine;// The thing is confirmed// I'm triggered in allllll the events!!! machine;