Constructor
new Router(map)
Maintains a list of triggers ("commands") and their behaviors.
Parameters:
Name | Type | Description |
---|---|---|
map |
Object | Map of command names => behaviors. |
- Source:
Extends
Methods
commit()
Increment the vector clock, broadcast all changes as a transaction.
- Overrides:
- Source:
deserialize(input) → {State}
Take a hex-encoded input and convert to a State object.
Parameters:
Name | Type | Description |
---|---|---|
input |
String | [description] |
- Overrides:
- Source:
Returns:
[description]
- Type
- State
fork() → {State}
- Overrides:
- Source:
Returns:
- Type
- State
get(path) → {Mixed}
Retrieve a key from the State.
Parameters:
Name | Type | Description |
---|---|---|
path |
Path | Key to retrieve. |
- Overrides:
- Source:
Returns:
- Type
- Mixed
inherits(scribe) → {Scribe}
Use an existing Scribe instance as a parent.
Parameters:
Name | Type | Description |
---|---|---|
scribe |
Scribe | Instance of Scribe to use as parent. |
- Overrides:
- Source:
Returns:
The configured instance of the Scribe.
- Type
- Scribe
now() → {Number}
Retrives the current timestamp, in milliseconds.
- Overrides:
- Source:
Returns:
Number representation of the millisecond Integer value.
- Type
- Number
render() → {String}
Compose a JSON string for network consumption.
- Overrides:
- Source:
Returns:
JSON-encoded String.
- Type
- String
(async) route(msg) → {Array}
Assembles a list of possible responses to the incoming request.
Parameters:
Name | Type | Description |
---|---|---|
msg |
String | Input message to route. |
- Source:
Returns:
List of outputs generated from the input string.
- Type
- Array
serialize(inputopt) → {Buffer}
Convert to Buffer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
input |
Mixed |
<optional> |
Input to serialize. |
- Overrides:
- Source:
Returns:
Store-able blob.
- Type
- Buffer
set(path) → {Mixed}
Set a key in the State to a particular value.
Parameters:
Name | Type | Description |
---|---|---|
path |
Path | Key to retrieve. |
- Overrides:
- Source:
Returns:
- Type
- Mixed
toHTML()
Converts the State to an HTML document.
- Overrides:
- Source:
toString() → {String}
Unmarshall an existing state to an instance of a Blob.
- Overrides:
- Source:
Returns:
Serialized Blob.
- Type
- String
trust(source) → {Scribe}
Blindly bind event handlers to the Source.
Parameters:
Name | Type | Description |
---|---|---|
source |
Source | Event stream. |
- Overrides:
- Source:
Returns:
Instance of the Scribe.
- Type
- Scribe
use(plugin, name) → {Router}
Attaches a new handler to the router.
Parameters:
Name | Type | Description |
---|---|---|
plugin |
Plugin | Instance of the plugin. |
name |
Plugin.name | Name of the plugin. |
- Source:
Returns:
Configured instance of the router.
- Type
- Router