Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

与Commander的兼容性问题 #74

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

与Commander的兼容性问题 #74

xingrz opened this issue Nov 25, 2012 · 0 comments

Comments

@xingrz
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant