-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
losing bound this in promise #63
Comments
You have to bind it before passing it to pify. |
I tried that also. I'll try it again. |
The correct way to do this is writeRaw(address, length, buffer) {
return pify(this.bus).i2cWrite(address, length, buffer)
} |
Merged
Fixed by #69. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My code is
but when i2cWrite is called
this
is undefined.this
is set when this runsbut not inside the called processFn function
What am I doing wrong?
P.S. Sorry I don't understand bind well enough to know what happens to a bound => function. I know => uses
this
from outside scope, but is that overridden by bind?EDIT: I just realized that looking at
this
before and during processFn means nothing. I will try to debug this better but meanwhile, can someone look at my code above?The text was updated successfully, but these errors were encountered: