[Greasemonkey] Script scoping

Edward Lee edilee at gmail.com
Mon May 2 12:55:58 EDT 2005


On 5/2/05, Andrew Hayward <greasemonkey at mooncalf.me.uk> wrote:
> That's all well and good, but what happens if I actually want to access
> another script?

You could stick things on the window like window.blah =
someBlahFunction;, but getting them there before the other scripts try
to access them could be tricky. At least for now, the scripts get
evaluated in the order added (probably in the same list that they show
up in the options menu), but that isn't really guaranteed.

If you want to access some variable of another script, you would have
to create getter/setter functions... (or just declare things without
var so things go into the global scope [not recommended!])
-- 
Ed


More information about the Greasemonkey mailing list