[Greasemonkey] Re: addEventListener inside loop

Jeremy Dunck jdunck at gmail.com
Sun Feb 5 13:13:29 EST 2006


On 2/5/06, (David *)Frenkiel <dfl.proxy at gmail.com> wrote:
> I don't see how this can work, since (afaik) event listeners have a fixed
> interface,

Except that foo isn't called as the event listener.  Instead, the
function returned by foo is the event listener.  Try the code before
you say it can't work.  ;-)

> The I handle such situations, is to stick the required value right into the
> function.
...
> f.param_i = i;

Right, so you're creating a closure manually.  Let JS do the work for you.  :)


More information about the Greasemonkey mailing list