【发布时间】:2012-09-14 19:53:10
【问题描述】:
我知道如何用咖啡脚本编写回调函数,如下所示:
test1.coffee
exports.cube=(callback)->
callback(5)
test2.coffee
test1=require('./test1')
test1.cube (result) ->
console.log(result)
我想知道如何在回调函数中添加参数? 这样我就可以这样使用它:
test1.cube(para,result)->
//use *para* to compute a *result*
//here can do something with *result*
【问题讨论】:
标签: node.js coffeescript