我想要覆盖async.waterfall()
(或编写timed_waterfall()
)以便打印每个步骤的执行时间。如何做到这一点?
async.waterfall([
f=>{
console.log('step1');
f();
},
f=>{
console.log('step2');
f();
},
f=>{
console.log('step3');
f();
},
],
()=>{
console.log('done');
})
期望输出:
step1
1ms
step2
2ms
step3
1ms
done
5ms