Function
Static Public Summary | ||
public |
dryadic(dryad: Dryad, layers: Array, rootContext: Object): DryadPlayer Short cut to create a DryadPlayer from a root Dryad optionally adding some layers. |
|
public |
hyperscript(root: Dryad | Array, lookupClassByNameFn: Function): Dryad Convert a JSON object tree into a tree of instantiated Dryads |
|
public |
run(command: *, context: *): * Calls a function, supplying the Dryad's context. May return a Promise for success/failure Usage: add() { return { run: (context) => { return new Promise((resolve, reject) => { // do something async like start a process, // fetch an image etc. // Dryad's properties: this.properties // Dryad's runtime context: context // on success call: resolve(); }); } }; } |
Static Public
public dryadic(dryad: Dryad, layers: Array, rootContext: Object): DryadPlayer source
import dryadic from 'dryadic/src/dryadic.js'
Short cut to create a DryadPlayer from a root Dryad optionally adding some layers.
public hyperscript(root: Dryad | Array, lookupClassByNameFn: Function): Dryad source
import hyperscript from 'dryadic/src/hyperscript.js'
Convert a JSON object tree into a tree of instantiated Dryads
A Domain-specific language for easily creating Dryad trees
className, properties: ['synth', {freq: 440}]
className, properties, children: ['audiobus', {numChannels: 2}, [ ['synth', {defName: 'saw', args: {freq: 440}] ]]
If there are only 2 items and the second is an Array (not Object), then parse it as:
className, children:
['group', [ ['synth', {freq: 440}] ]]
public run(command: *, context: *): * source
import run from 'dryadic/src/run.js'
Calls a function, supplying the Dryad's context. May return a Promise for success/failure
Usage:
add() { return { run: (context) => { return new Promise((resolve, reject) => { // do something async like start a process, // fetch an image etc. // Dryad's properties: this.properties // Dryad's runtime context: context // on success call: resolve(); }); } }; }
Params:
Name | Type | Attribute | Description |
command | * | ||
context | * |
Return:
* |