Peter Michaux wrote:
> On 12/15/06, Eric Harrison <[EMAIL PROTECTED]> wrote:
> >
> > But yeah, stay away from anonymous functions if there is any chance
> > you'll ever want to remove that event observation.
>
> In the spirit of this comment it isn't it more than just anonymous
> function that are the problem?
No.
>
> <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.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---