chainable
Create fluent asynchronous APIs.
Usage
Extend the Chainable
class and use the chainable
combinator to designate
asynchronous methods as being chainable. Methods wrapped with the chainable
combinator will be treated as chainable when they are not passed a callback.
Each method in the chain will be executed in series, passing it's result to the
next method. Pass a callback to the final method to end the chain and begin
computation.
Example
chainable = require 'chainable' numbers: number: chainable @numberspush number callback null add: chainable result = 0 while n = @numberspop result += n callback nullresult wait: chainable setTimeout -> callback null 100 test = testnumber4 number5 wait add # result == 9