A simple EventEmitter example:
va branch = EventEmitter = EventEmitter; //first give branch var chain = ;chainsource ; //called twice - once per each event emitterchain; //called against each event emitterchain;
With soda.js
var chain =
API
.branch(...schemas)
schemas
- class, object, or array of methods to use in the chain. For example:
//using a classvar chain = ;chain; //using an object or prototypechain = ; chain; //using an arraychain = ;chain;
Creates a new chained object
chain.source(sourceArray)
sets the source for the chain
chain.pre(method, factory)
middleware for any method before it's actually called. If method
is omitted, then all methods will be run the the middleware function.
var chain = ; //actual listener chain; chain;
chain.add(...items)
adds an item to the chain
Result chain.[CHAIN_METHOD]
created from the prototype, array, or object in the .branch()
function.
hain result.async()
Makes the chain asynchronous
var chain = ;chainsource1 2 3 4; chain
chain result.sync()
Makes the chain synchronous - values from returned arrays will be
var chain = ;chain;var result = chain; console; //[2], [3], [4], [5]