[Greasemonkey] "Bloglines Keep All New Link" User script

Jeremy Dunck jdunck at gmail.com
Wed Jun 8 18:07:29 EDT 2005


On 6/8/05, Bill Donnelly <donnelly at snowcrest.net> wrote:
> Didn't someone suggest recently that all functions
> should be defined as:
> 
> foo = function() {}
> 
> ? or only in certain circumstances?

Well, I kinda like window.foo better than just foo, since it's more
obvious why you're doing it.

But the point is, all GM scripts are wrapped, and if you want to
access them outside of the originally injected scope chain, you'll
need to export them.  Put another way: by adding window.foo, you're
guaranteeing that foo is in any further JS's scope chain.

But you should only do that if you need to, since you're cluttering
the shared page namespace at that point.


More information about the Greasemonkey mailing list