// ==UserScript==
// @name Greasemonkey set-and-get Example
// @description Stores and logs a counter of executions.
// @grant GM.setValue
// @grant GM.getValue
// ==/UserScript==
async function GM_getValue(name, value) {
try {
return await GM.getValue(name, 0)
}
catch(e) {
console.log("GM_getValue", e);
}
}
async function GM_setValue(name, value) {
try {
await GM.setValue(name, value)
}
catch(e) {
console.log("GM_setValue", e);
}
}
var test = GM_getValue('count',0);
GM_setValue('count', test + 1);
var testafter = GM_getValue('count',0);
console.log("NEW_Count", testafter);
The script returning a promise. What is wrong? Thank you for your help
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.