Hi,
> Isn't this the one case where bindAsEventListener() is actually
> needed?
No, more here:
http://proto-scripty.wikidot.com/prototype:tip-you-probably-don-t-need-bindaseventlistener
...but Matt was mistaken when he said the argument would show up after
the event. When you use #bind, the even
On Jul 23, 10:14 pm, Matt Foster wrote:
> You can just add parameters to the bind call and they will show up in
> execution.
>
> $(id).observe('mousedown', this.myFunction.bind(this, otherParam);
>
> Then I believe it shows up after the event.
Isn't this the one case where bindAsEventListener() i
You can just add parameters to the bind call and they will show up in
execution.
$(id).observe('mousedown', this.myFunction.bind(this, otherParam);
Then I believe it shows up after the event.
function myFunction(event, param){...
but in your case, simply binding to "this" will allow you to refe
Hi,
Since you're creating the event handler inside your `initialize`
function, you can take advantage of the fact it's already a closure by
assigning `this` to a local variable (`self` is a common name for it)
and then using `self` within the closure (the event handler), since it
will inherit it.