Bob Ippolito wrote:
> On 9/11/06, markus espenhain <[EMAIL PROTECTED]> wrote:
>>
>> i'm using MochiKit.Signal for app internal event based communication too
>> and i've just updated MochiKit sources from rev 667 (something before
>> 1.3 release) to 1.3.1 and to current HEAD but connect(obj, 'asd',
>> this.doAsd) and signal() doesn't work anymore as expected - doAsd() is
>> called but 'this' isn't bound to the object which has done the connect
>> ... all objects are calling bindMethods(this) in constructor
>>
>> any idea?
>
> Could you put together a little example that demonstrates this? If
> "this.doAsd" is bound with bindMethods, there's no way that "this" can
> change to anything but the object it was originally bound to... so I'm
> not sure I really understand where the expectation differs or how it
> could've changed across those versions.
>
> -bob
yes - here it is
A = function() {
bindMethods(this);
};
A.prototype = update({}, {
init: function() {
this.qwe = 123;
this.b = new B();
connect(this.b, 'asd', this.onAsd);
this.b.test();
},
onAsd: function() {
alert(this.qwe) // <- undefined
alert(this.test) // <- func def
}
});
B = function() {
bindMethods(this);
};
B.prototype = update({}, {
test: function() {
signal(this, 'asd');
}
});
new A().init();
it seems that 'this' is bound to signal src that - this.test in onAsd()
is not undefined ... ?
thanks
markus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---