i tried to do something like this
function f1() {
d = new Deferred();
callLater(0, d.callback, 1);
return d;
}
function f2() {
f1().addCallback(console.log, 'hello from f2');
}
f2();
// nothing happens
... and i noticed that deferred methods are not bound to deferred obj
and that it is done manual, e.g. in MochiKit.Async.wait() -
m.bind("callback", d),
so why deferred methods not bound by default to a deferred instance? -
if there is a reason for that please be so kind to let me know
thanks
markus
They're not bound by default because methods aren't bound in
JavaScript. To give the illusion of binding there'd be additional
overhead for every Deferred object instantiation and every method
call. MochiKit doesn't change how JavaScript works fundamentally.
-bob