On Wed, Oct 8, 2008 at 12:56 AM, Akari no ryu <[EMAIL PROTECTED]> wrote:
> Troels, the problem with using prototypical inheritance is that you
> end up losing scope in, for example, AJAX request responses or DOM
> event handlers.

If you want to keep scope in an event handler, you can delegate to it,
using a closure:

    connect(
      'myID', 'onclick',
      function() {
        foo.bar();
      });

Or, if you prefer, you can use the MochiKit-provided `bind` function,
to do the same:

    connect('myID', 'onclick', bind('bar', foo));

--
troels

--~--~---------~--~----~------------~-------~--~----~
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