Skip to content

Instantly share code, notes, and snippets.

@twitchy
Created June 6, 2014 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twitchy/b09734692e01215c1583 to your computer and use it in GitHub Desktop.
Save twitchy/b09734692e01215c1583 to your computer and use it in GitHub Desktop.
Invoke method in from within a callback
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