only store values that differ from defaults

This commit is contained in:
Laurent Mazet 2021-04-20 14:13:58 +02:00
parent 3384a8c1f7
commit 9c2408c560
1 changed files with 7 additions and 1 deletions

View File

@ -138,7 +138,13 @@
(type === "number") ||
(type === "object") ||
(type === "string")) {
localStorage.setItem("trivabble" + key, value);
if (Object.prototype.hasOwnProperty.call(Conf, key) && (Conf[key] === value)) {
if (Object.prototype.hasOwnProperty.call(localStorage, "trivabble" + key)) {
delete localStorage["trivabble" + key];
}
} else {
localStorage.setItem("trivabble" + key, value);
}
} else {
console.error("Unsupported type");
}