Create an Account
username: password:
 
  MemeStreams Logo

RE: Encapsulating XmlHttpRequest Calls within JavaScript classes

search


RE: Encapsulating XmlHttpRequest Calls within JavaScript classes
by Lost at 6:29 pm EST, Dec 11, 2006

Acidus wrote:
Or, solving the scope issue of callback functions without resorting to global variables!

//set the var so we can scope the callback var _this = this; //callback will be an anonymous function that calls back into our class //this allows the call back in which we handle the response (_onData()) // to have the correct scope. this._request.onreadystatechange = function(){_this._onData()};

Aye, I started doing this once someone on ##javascript on freenode told me so.

RE: Encapsulating XmlHttpRequest Calls within JavaScript classes


 
 
Powered By Industrial Memetics