You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Command.js的.choose(list, fn)方法,直接fromCallback绑定会报TypeError: undefined is not a function(似乎是回调fn没有传过去),但像下面那样自己包多一层function就没事。
var program = require('commander');
var Wind = require('wind'),
Binding = Wind.Async.Binding;
/* this dosen't work */
program.chooseAsync = Binding.fromCallback(program.choose);
/* this does work */
/*program.chooseAsync = Binding.fromCallback(function(list, fn) {
program.choose(list, fn);
});*/
eval(Wind.compile('async', function () {
var list = ['javascript', '.net', 'php', 'ruby', 'python'];
var choise = $await(program.chooseAsync(list));
console.log('you just chose: %s', choise);
}))().start();
The text was updated successfully, but these errors were encountered:
Command.js的
.choose(list, fn)
方法,直接fromCallback
绑定会报TypeError: undefined is not a function
(似乎是回调fn没有传过去),但像下面那样自己包多一层function就没事。The text was updated successfully, but these errors were encountered: