[Greasemonkey] Aardvark firefox extension -> GM user script

Edward Lee edilee at gmail.com
Wed Apr 27 15:48:01 EDT 2005


On 4/27/05, Prakash Kailasa <pk-moz at kailasa.net> wrote:
> Can this be simplified as:
> 
>   setTimeout(function() { advrk_clearPrompt(promptInc); }, 400);
> 
> since promptInc is already in the containing scope and is available to
> the anonymous function?

Should be fine that way if promptInc does not change. Such as..

function(promptInc) {
  ..lalala
  setTimeout(function() { advrk_clearPrompt(promptInc)}..
  .. nothing modifying promptInc
}

However, if something changes the value of promptInc before the
timeout is triggered, you'll have to wrap it around another function.
-- 
Ed


More information about the Greasemonkey mailing list