On 12/16/06, RobG <[EMAIL PROTECTED]> wrote:

> > <pseudocode>
> >
> >   function attachMyObserver() {
> >     function handler(){}
> >     attach("myDiv", 'click', handler);
> >   }
> >
> > </pseudocode>
> >
> > So it isn't an anonymous function but a named inner function. Now how
> > would i detach just that handler? There isn't a reference to it
> > outside the outer function.
>
> The reference is 'handler', you pass it in the call, it creates a
> closure back to the outer function.

So what is the syntax to do this?

<pseudocode>

  function attachMyObserver() {
     function handler(){}
     attach("myDiv", 'click', handler);
   }

  attachMyObserver();
  detach('myDiv', 'click', handler);

</pseudocode>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to