我正在尝试让 Step.js 库与咖啡脚本一起正常工作。我对咖啡很陌生,但这是我的尝试:
setTimeout(
=>
console.log("step 1 at #{new Date}")
setTimeout(
=>
console.log("step 2 at #{new Date}")
setTimeout(
=>
console.log("step 3 at #{new Date}")
10000
)
10000
)
10000
)
# step 1 at Tue Nov 13 2012 13:18:51 GMT-0600 (CST)
# step 2 at Tue Nov 13 2012 13:19:01 GMT-0600 (CST)
# step 3 at Tue Nov 13 2012 13:19:11 GMT-0600 (CST)
应与以下内容相同:
step(
->
setTimeout(
=>
console.log("step 1 at #{new Date}")
this(null)
10000
)
->
setTimeout(
=>
console.log("step 2 at #{new Date}")
this(null)
10000
)
->
setTimeout(
=>
console.log("step 3 at #{new Date}")
this(null)
10000
)
)
# step 1 at Tue Nov 13 2012 13:12:04 GMT-0600 (CST)
# step 2 at Tue Nov 13 2012 13:12:04 GMT-0600 (CST)
# step 3 at Tue Nov 13 2012 13:12:04 GMT-0600 (CST)
正如您从上面的示例步骤中看到的那样,同时执行所有步骤,而不是像预期的那样一次执行一个步骤。我不太清楚为什么现在是这样。