Skip to content

Instantly share code, notes, and snippets.

@sizzlemctwizzle
Created February 5, 2011 23:35
Show Gist options
  • Save sizzlemctwizzle/812926 to your computer and use it in GitHub Desktop.
Save sizzlemctwizzle/812926 to your computer and use it in GitHub Desktop.
Test
// ==UserScript==
// @name Script1
// @namespace http://test.free.fr
// @description Script1
// @include *
// ==/UserScript==
window.func = function(getter, setter) {
var val = getter('val');
++val;
GM_setValue('val', val);
++val;
setter('val', val);
return GM_getValue;
};
// ==UserScript==
// @name Script2
// @namespace http://test.free.fr
// @description Script2
// @include *
// ==/UserScript==
var val = 1;
GM_setValue('val', val);
var getter = func(GM_getValue, GM_setValue);
alert(val + " + " + getter('val') + " = " + GM_getValue('val'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment