Created
June 23, 2014 04:16
-
-
Save adammcarth/661e29a2859dc28e6018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Foo( callback ) { | |
| this.callback = callback; | |
| } | |
| Foo.prototype.Bar = function() { | |
| xhr = new XMLHttpRequest(); | |
| xhr.onreadystatechange = function() { | |
| console.log(this.callback); | |
| // => undefined | |
| } | |
| xhr.onreadstatechange = function( this ) { | |
| console.log(this.callback); | |
| // => Uncaught TypeError: Undefined is not a function. | |
| } | |
| xhr.onreadystatechange = function() { | |
| console.log(Foo.callback()); | |
| // => Uncaught TypeError: Undefined is not a function. | |
| } | |
| // Hmmm.... | |
| // How can I get Foo's calback argument? | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment