Aha, thanks. I will use bind(); On Mar 28, 3:27 pm, "Ryan Gahl" <[EMAIL PROTECTED]> wrote: > And to be even more clear, as I just noticed your statement: > " I just didn't put two and two together and realize that a click and a > response are the same thing, events! " > > They're not. The reason bind and bindAsEventListener exist are for the same > thing, which is to fix an object instance's scope to the executing context > of the function being bound. Functions, in javascript, are objects, so > normally "this" within a function refers to the function itself, unless the > function is being executed from within another object's context. When you > pass callback functions into processes like dom event handling or Ajax > requests... when those functions get executed they are now outside of the > context of the object. So in these cases you must use .bind(this)... and > .bindAsEventListener is, again, only if you need access to the DOM event > object.
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
