[Greasemonkey] How to modularize GM scripts?

Lenny Domnitser ldrhcp at gmail.com
Mon Apr 24 18:50:24 EDT 2006


On 4/24/06, Philip Friedman - Auto Europe <philip at autoeurope.com> wrote:
> Is there a recommended way to break up GM scripts? I have a bunch of objects
> I'd like to share between several scripts. What is the best way to maintain
> them in separate files and include them from the main GM script at runtime?

Depending on the type of object you are saving, this might work:

// Save object
GM_setValue('whatever', uneval(myObj));

// Retrieve object
var myObj = eval(GM_getValue('whatever'));


More information about the Greasemonkey mailing list