s
s
snc
Search…
waterfall
snc.waterfall(array_functions(done, data), callback_end(data))
Runs next function when "done" method is executed. Alternative name: wf.
1
snc.waterfall([
2
done => {
3
console.log(`fire`)
4
done(5)
5
},
6
(done, data) => {
7
console.log(`ice: ${data}`)
8
done("win")
9
}
10
],
11
data => {
12
console.log(`End: ${data}`)
13
})
Copied!
1
-> fire
2
-> ice: 5
3
-> End: win
Copied!
Break the waterfall with "true".
1
snc.wf([
2
done => {
3
console.log(`fire`)
4
done(true, 5)
5
},
6
(done, data) => {
7
console.log(`ice: ${data}`)
8
done(`win`)
9
}
10
], data => {
11
console.log(`End: ${data}`)
12
});
Copied!
1
-> fire
2
-> End: 5
Copied!
Copy link