Modules@robinpath/state
@robinpath/state
0.1.0PublicFinite state machine with transitions, guards, actions, context, history, and event listeners
@robinpath/state
Finite state machine with transitions, guards, actions, context, history, and event listeners
Why use this module?
The state module lets you:
- Create state machine
- Send event to trigger transition
- Get current state
- Get machine context
- Check if event can be sent
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/state
Quick Start
No credentials needed — start using it right away:
state.send "next" "light"
Available Functions
| Function | Description |
|---|---|
state.create | Create state machine |
state.send | Send event to trigger transition |
state.current | Get current state |
state.context | Get machine context |
state.setContext | Set machine context |
state.can | Check if event can be sent |
state.events | Get available events from current state |
state.is | Check if in specific state |
state.reset | Reset to initial state |
state.history | Get transition history |
state.addTransition | Add transition at runtime |
state.addState | Add state at runtime |
state.on | Listen for transitions |
state.serialize | Serialize machine to JSON |
state.matches | Check if current state matches any |
state.destroy | Destroy machine |
state.list | List all machines |
Examples
Send event to trigger transition
state.send "next" "light"
Get current state
state.current "light"
Get machine context
state.context "light"
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/state";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
state.send "next" "light"
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.0 | latest | yesterday |
Related Modules
devops
0
@robinpath/bitbucket
v0.1.1robinpath
Bitbucket module for RobinPath.
0 downloads
...
devops
0
@robinpath/box
v0.1.1robinpath
Box module for RobinPath.
0 downloads
...
devops
0
@robinpath/cache
v0.1.1robinpath
In-memory key-value cache with optional TTL expiration for temporary data storage
0 downloads
...
devops
0
@robinpath/cloudflare
v0.1.1robinpath
Cloudflare module for RobinPath.
0 downloads
...
Install
$ robinpath install @robinpath/state Version0.1.0
LicenseMIT
Unpacked Size5.4 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

