Created
March 7, 2011 18:15
-
-
Save phiggins42/858908 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
dojo.declare("Foo", null, { | |
url:"/example.txt", | |
constructor: function(){ | |
dojo.xhrGet({ | |
url: this.url, | |
// pass a string as 2nd to hitch(). means this._handler(): | |
load: dojo.hitch(this, "_handler"), | |
// or a function. 1st arg means context to use | |
error: dojo.hitch(this, function(response){ | |
/* `this` is the context of the instance, hitched before */ | |
}) | |
}) | |
}, | |
_handler: function(data){ | |
/* called by the xhr call in constructor */ | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment