internal-msg-bus
v0.0.1
Published
A tiny internal messaging bus
Readme
Msg
A tiny internal messaging bus
version 0.0.1
Enum State
Possible States
| FAIL | PEND | STAT |
| --- | --- | --- |
| -1 | 0 | 1 |
Interface bus
| stat | step | max | id
| --- | --- | --- | --- |
| the bus state | current step | maximum steps | bus id |
Class msg
Properties
bus
private
Methods
msg.id
msg.id() // Returns bus IDmsg.stat ⇒ State
msg.stat() // returns bus status, -1 | 0 | 1msg.fail
msg.fail() // Set state to -1 to indicate failuremsg.succ
msg.succ() // Set state to 1 to indicate failuremsg.reset
msg.reset(id, mx?)Reset msg state to pending, change ID to id and maximum steps to mx if provided.
if mx is not provided, it will be set to 0.
| arg | type | descrption |
| --- | --- | --- |
| id | number required | new ID |
| mx | number optional | maximum steps |
msg.step
msg.step()increments bus step, sets bus status to -1 if the new count is greater than the maximum allowed number of steps.
