teambition/then.js

能否用有名函数替代匿名函数

Closed this issue · 1 comments

thenjs Thenjs(start, [debug]) 中的 start 能否用用有名函数代替,demo中都是匿名函数,若是能参数怎么传递,是否能给个例子,谢谢

zensh commented

如果是函数,只能接收 function (callback) { ... } 形式的函数,如果你要传参,那只能这样:

function test (a, b) {
  return function (callback) { ... }
}

thenjs(test(a, b)).then(...)