We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
this
I use co inside my class method function, and lost this in closures inside co when I call it via a instance...
example code:
const co = require('co') class Test { constructor() { this.id = 3 } test_with_bind_this() { co(function* () { console.log(this.id) }.bind(this)) } test() { co(function* () { console.log(this.id) }) } } const t = new Test() t.test() // output undefined t.test_with_bind_this() // output 3
is there a easy way to bind to this automatically?
The text was updated successfully, but these errors were encountered:
I usually do co.call(ctx, function*() {}) which is not very bothering
Sorry, something went wrong.
??
@alsotang Thank you! Sorry, my bad. I've removed my misguiding comment.
No branches or pull requests
I use co inside my class method function, and lost
this
in closures inside co when I call it via a instance...example code:
is there a easy way to bind to
this
automatically?The text was updated successfully, but these errors were encountered: