[Greasemonkey] Silly JavaScript question

Dan Phiffer dan at phiffer.org
Wed Jul 20 14:42:13 EDT 2005

Yeah, this makes sense. I'm actually going with Julien's solution,  
but this is a good pattern to have in the toolbox.

I guess that setTimeout syntax really isn't really official, but a  
similar construct should be more widely supported for setInterval (at  
least according to my O'Reilly book).


On Jul 20, 2005, at 9:51 AM, Edward Lee wrote:

> Yeah, you can either create a new named function or use an anonymous
> one. Here's an example I put in the Patterns topic [1] a long while
> back.
> I didn't know Firefox allowed extra arguments for setTimeout (other
> browsers don't support that), but basically you create a closure by
> passing in the value to the function.
> for (prop in something) { (function(prop) {
>   ...
> }) (prop); }
> [1] http://mozdev.org/pipermail/greasemonkey/2005-April/001305.html
> -- 
> Ed
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey

More information about the Greasemonkey mailing list