GM_getValue/GM_setValue are synchronous:
GM_setValue("variable", "test");
console.log(GM_getValue("variable"));
// logs 'test'
Looking at the source code (scriptAPI.js), it appears GM_setValue is just mapped directly to GM.setValue:
script.defineGlobals({
GM,
GM_setValue: GM.setValue,
GM_getValue: GM.getValue,
GM_deleteValue: GM.deleteValue,
GM_listValues: GM.listValues,
GM_openInTab: GM.openInTab,
GM_setClipboard: GM.setClipboard,
GM_notification: GM.notification,
GM_xmlhttpRequest: GM.xmlHttpRequest,
GM_getResourceURL: GM.getResourceUrl,
GM_info: GM.info,
GM_fetch: GM.fetch
});
I'm not sure if GM_setValue needs to be changed, but GM_getValue returning a promise prevents some userscripts (including mine) from properly working. I'm guessing GM_listValues should also be synchronous.
Thank you for doing this by the way, it's great to have more options :)
GM_getValue/GM_setValue are synchronous:
Looking at the source code (scriptAPI.js), it appears
GM_setValueis just mapped directly toGM.setValue:I'm not sure if GM_setValue needs to be changed, but
GM_getValuereturning a promise prevents some userscripts (including mine) from properly working. I'm guessingGM_listValuesshould also be synchronous.Thank you for doing this by the way, it's great to have more options :)