Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

与Commander的兼容性问题 #74

Open
xingrz opened this Issue Nov 25, 2012 · 0 comments

Comments

Projects
None yet
1 participant

xingrz commented Nov 25, 2012

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment