DryadPlayer
Manages play/stop/update for a Dryad tree.
A Dryad has no state or functionality until it is played by a DryadPlayer. A Dryad can be played more than once at the same time by creating more DryadPlayers.
The DryadPlayer also holds the layers and command middleware which execute the functionality that the Dryads specify.
Constructor Summary
Public Constructor | ||
public |
constructor(rootDryad: *, layers: *, rootContext: {}) |
Member Summary
Public Members | ||
public |
classes: * |
|
public |
log: * |
|
public |
middleware: * |
|
public |
tree: * |
Method Summary
Public Methods | ||
public |
Register a Dryad class so it can be located when used in hyperscript. |
|
public |
callCommand(nodeId: *, command: *): * Execute a single command object for a single node using middleware outside the prepareForAdd/add/remove full tree command execution routine. |
|
public |
Lookup Dryad class by name. |
|
public |
getDebugState(): * Get a representation of current state of the tree. |
|
public |
Convert hyperscript graph to Dryad objects with registered classes |
|
public |
|
|
public |
Set a new tree. |
|
public |
|
|
public |
updateContext(context: *, update: *): * Allow a Dryad to update its own context. |
|
public |
Add a layer of functionality by registering Dryad classes and command middleware. |
Public Constructors
public constructor(rootDryad: *, layers: *, rootContext: {}) source
Params:
Name | Type | Attribute | Description |
rootDryad | * | ||
layers | * | ||
rootContext | {} |
|
Public Members
public classes: * source
public log: * source
public middleware: * source
public tree: * source
Public Methods
public addClass(dryadClass: Dryad) source
Register a Dryad class so it can be located when used in hyperscript. Also needed if a class uses requireParent()
Params:
Name | Type | Attribute | Description |
dryadClass | Dryad |
public callCommand(nodeId: *, command: *): * source
Execute a single command object for a single node using middleware outside the prepareForAdd/add/remove full tree command execution routine.
This can be called out of band from a Dryad's add/remove method
Its for commands that need to be executed during runtime in response to events, streams etc. eg. spawning synths from an incoming stream of data.
Params:
Name | Type | Attribute | Description |
nodeId | * | ||
command | * |
Return:
* |
public getClass(className: String): Dryad source
Lookup Dryad class by name.
Used by hyperscript and requireParent, this requires that layers and their classes were registered and any custom classes that you right are registered. If you aren't using hyperscript then you don't need to register your class.
Params:
Name | Type | Attribute | Description |
className | String | case-insensitive |
public getDebugState(): * source
Get a representation of current state of the tree. Contains add|remove|prepared and may hold errors.
Return:
* |
public h(hgraph: Object): Dryad source
Convert hyperscript graph to Dryad objects with registered classes
Params:
Name | Type | Attribute | Description |
hgraph | Object | JSON style object |
public setRoot(dryad: Dryad) source
Set a new tree.
Behavior while already playing is not yet defined.
Params:
Name | Type | Attribute | Description |
dryad | Dryad |
public updateContext(context: *, update: *): * source
Allow a Dryad to update its own context.
Contexts are immutable - this returns a new context object.
Params:
Name | Type | Attribute | Description |
context | * | ||
update | * |
Return:
* |