bucks.js
Async chain utility for node and the browser. (amd support)
Build
dependence) node.js
$ npm install .
$ make
Examples
add and end
add
is general way to add a task to bucks object.
end
starts executing added tasks.
Results and errors can be passed to next task in various way.
task is generally task(err, res, next)
form function.
next task waits until next
is called in previous task.
if next
is not specified, next task is called immediately with
returned value.
//// new Bucks object//var b = ; //// Add and add several tasks.//b;
then
then
adds a task called only in case of success
b = ;b;
delay
delay
add delay execution
b = ;b // 1ms;
error
error
adds a task called only in case of error
b;
final errorback in end
Second param in end
works as final errorback.
//// last error back//b = ;b;
uncaught error
uncaught errors properly thrown to outside of chain.
try var b = ; b; catche // e => 'error'
waterfall
waterfall
is another way to add several tasks.
var { return 't1';};var { return 't2';}; t1 t2; // same ast1;
parallel
parallel
executes tasks in asynchronous way and join their results
b = ; b;
onError
onError
Function to handle exceptions that have not been processed
var { console;}; // Bucks.onError!!Bucks;var b0 = ;b0 ;
dispose
var b0 = ; b0 { delete b0dummy;} b0 ;
DEBUG
The output debug log
Bucks.DEBUG = true;
AUTHORS
Kei FUNAGAYAMA
Kazuma MISHIMAGI
CyberAgent Publicity
Changelog
@see https://github.com/CyberAgent/bucks.js/blob/master/Changelog
Copyright
CyberAgent, Inc. All rights reserved.
License
MIT @see https://github.com/CyberAgent/bucks.js/blob/master/LICENSE