I'm afraid the problem was even more embarrassing than that.
request.addCallbacks is a method
request.addCallBacks is not.
Stupid dyslexia.
Bob Ippolito wrote:
It looks like your problem is that your usage of partial probably
doesn't do what you intend it to.
request.addCallBacks(
partial(this.typeLoaded, i),
partial(this.typeFailed, i)
);
With that expression, you lose the binding to this (since JavaScript
has no bound methods).
You probably want to use bind or method instead of partial in such a
way that you can keep the this binding.
-bob
On Wed, Oct 1, 2008 at 10:41 PM, Akari no ryu [EMAIL PROTECTED] wrote:
I've been battling with this for a few hours now, been reading the
docs and read this groups mails on defferred.callback
None of that seems to help.
My code does the following:
this.interfaceTypes = {
'lines':false,
'regions':false,
'points':false
};
for(var i in this.interfaceTypes)
{
var url = i+'.php';
var queryString =
MochiKit.Base.queryString({'do':'fetchTypes'});
log('created url of '+url+' and queryString of '+queryString);
try
{
var request = MochiKit.Async.doXHR(url);
request.addCallBacks(
partial(this.typeLoaded, i),
partial(this.typeFailed, i)
);
}
catch(e)
{
for(var j in request)
{
log('request.'+j+\n+request.j)
}
}
}
For all values of request's properties, it's showing up as undefined.
Also, if I don't litter my constructor with log calls, the log calls
don't happen in there and a log call after it won't happen either.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---