s
s
snc
Search…
⌃K

waterfall

snc.waterfall(array_functions(done, data), callback_end(data))
Runs next function when "done" method is executed. Alternative name: wf.
snc.waterfall([
done => {
console.log(`fire`)
done(5)
},
(done, data) => {
console.log(`ice: ${data}`)
done("win")
}
],
data => {
console.log(`End: ${data}`)
})
-> fire
-> ice: 5
-> End: win
Break the waterfall with "true".
snc.wf([
done => {
console.log(`fire`)
done(true, 5)
},
(done, data) => {
console.log(`ice: ${data}`)
done(`win`)
}
], data => {
console.log(`End: ${data}`)
});
-> fire
-> End: 5