[Greasemonkey] Cross-script configuration data sharing

Gareth Andrew freega at freegarethandrew.org
Sat Jan 7 00:43:00 EST 2006


Yep this is definitely a problem I've run into, in my use case I have a
couple of scripts that use del.icio.us data, I use GM_setValue as a
cache for this information so I make much less xhr requests.  Each of my
scripts currently has to have its own cache.

My simple solution would be to add a (optional) namespace parameter to
GM_Get/SetValue.  Scripts could access other scripts namespace, or
scripts could use a separate shared namespace.  In my case, this
solution seems particularly elegant since the code using the
GM_get/setValue functions is encapsulated in a separate library (using
GM_Imports) and it makes sense for the library to have its own
namespace.

Gareth


On Fri, 2006-01-06 at 17:09 -0500, Lenny Domnitser wrote:
> On 1/6/06, Devin Cook <Devin.Cook at gmail.com> wrote:
> > Maybe scripts with the same namespace could share the same values?
> 
> It's an elegant solution, but I think script namespaces have to be
> differentiated from shared value namespaces. The proposal would have
> people writing scripts in namespaces out of their control to interact
> with certain scripts, creating an opportunity for naming conflicts.
> 
> Maybe a new set of GM_* function is in order: exportValue/importValue.
> I'm not sure of the best way to keep naming conflicts out of this
> one--perhaps explicitly asking for a variable namespace, or maybe just
> having a convention to name variables a certain way, but neither of
> these sounds optimal to me.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey



More information about the Greasemonkey mailing list