Allow all types in GM_setValue

While https://wiki.greasespot.net/GM.setValue still says:
> Strings, booleans, and integers are currently the only allowed data types.

https://sourceforge.net/p/greasemonkey/wiki/GM_setValue/ claims:
> Prior to version 3.2 simple data objects, such as JSON, were not allowed.

And there seem to be scripts actually using those, e.g.:
https://greasyfork.org/en/scripts/394820-mouseover-popup-image-viewer
This commit is contained in:
Florian Bruhin 2021-09-20 13:37:29 +02:00
parent 1bea826981
commit c2ef2a2918
1 changed files with 0 additions and 5 deletions

View File

@ -22,11 +22,6 @@
function GM_setValue(key, value) {
checkKey(key, "GM_setValue");
if (typeof value !== "string" &&
typeof value !== "number" &&
typeof value !== "boolean") {
throw new Error(`GM_setValue requires the second parameter to be of type string, number or boolean, not '${typeof value}'`);
}
localStorage.setItem(_qute_script_id + key, value);
}