[Greasemonkey] Script scoping

Bill Donnelly donnelly at snowcrest.net
Tue May 3 02:44:28 EDT 2005


One thing you might be able to do is check if
a function (fB) is available, and, if not, set up
the loaded function (fA) to be called again after
some amount of time using the setTimeout function.
So, if you define them as primary window global
with: "window.fB = function () {}"
(or however that works), then it should work.
Of course, you should make these global functions
name-unique with some sort of a prefix, like
GM_XX_xxxxx(), or something like that.

Does anyone know exactly what the specifics are
of this new loading system as to what context
each of these scripts is loaded, and how one
might be able to reference them?

Are they 100% privately scoped with no ability
to reference them or check for them or anything
like that? (is there a "script" collection that
can be traversed? the Web Developer extension
does this, altho, as I mentioned some time back,
it no longer lists the Gm scripts, so even it
doesn't see them anymore apparently, which sux)

I guess I'm still a little confused on how all
that works.



More information about the Greasemonkey mailing list