Created
June 6, 2014 05:24
-
-
Save twitchy/b09734692e01215c1583 to your computer and use it in GitHub Desktop.
Invoke method in from within a callback
This file contains 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 MyClass() { | |
this.myCallback = function() { | |
alert("MyClass.myCallback()"); | |
}; | |
this.startRequest = function() { | |
var myself = this; | |
GM_xmlhttpRequest({ | |
'method': 'GET', | |
'url': "http://www.google.com/", | |
'onload': function (xhr) { | |
myself.myCallback(); | |
} | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment