@hugov/step v0.3.0
@hugov/step
• Constructor • Instance • Gotcha • License •
Constructor
Step(Function): Step
If the Function is binary, it is considered to be an async CPS function with the callback as a second parameter
Works as a constructor (step = new Step()
) and as a factory (step = Step()
)
Step.all(Array<Step>, [Function])
If the Function is binary, it is considered to be an async CPS function with the callback as a second parameter
Step.last(Function|Step)
If the Function is binary, it is considered to be an async CPS function with the callback as a second parameter
Creates a step wrapper that debounces the inner step to only keep the latest outcome
Step.pick( v => i )
Creates a step that switches to a single dependent depending on the input value
Instances
step.push(v): this
Pushes a value to the step and it's dependents
step.pipe(Function|Step): Step
If the Function is binary, it is considered to be an async CPS function with the callback as a second parameter
Creates and returns a dependent step
step.from(Function|Step): Step
If the Function is binary, it is considered to be an async CPS function with the callback as a second parameter
Creates and return a predecessor step
Factories
require('@hugov/step/from-async)(nodeAsyncFunction): Step
Creates a new step from a node-style async function (val, (err,res) => void) => void
require('@hugov/step/from-port)(MessagePort): Step
Creates a new step from an object having postMessage
and onmessage
methods
require('@hugov/step/from-xhr)(): Step
Creates a new step from a remote GET
request. The steps accepts an url and will fire a json object as a response
Gotcha
- no error handling. On error, throw.
- the async CPS style functions
(value, v=>void)=>void
are different from node style callbacks(err, res)=>void