Hi all, I'm something of a newcomer to MochiKit to forgive me if this
is a silly question.

When using Signal's 'connect' function to add signal callbacks I'm
using the form:

var obj = new MyObj;
connect(window, "onload", obj, 'init');

So that 'this' still refers to obj in the init function.

However, I'm also using custom callbacks for a Draggable I'm creating,
e.g.:

var dr = new Draggable($('drag'), {
    'onchange': this.dragMoved
}

In the MyObj.dragMoved function I need access to the obj object, but
'this' refers to the signal source.

I tried:
    'onchange': partial(this.dragMoved, this)
adding a 'self' parameter onto MyObj.dragMoved, but self seemed to be
a copy of 'this' as it was when I connected the callback, rather than
the live version - a closure in other words.

Is there a way for me to get at the live obj instance in this
situation?

Thanks,
James


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to