only store values that differ from defaults
authorLaurent Mazet <mazet@softndesign.org>
Tue, 20 Apr 2021 12:13:58 +0000 (14:13 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 20 Apr 2021 12:13:58 +0000 (14:13 +0200)
public/trivabble.js

index 2057c09b5bff587daa06de4a4d5e715f92a15a25..65b8580f35deae523a0376b64f3fc108fa699f46 100644 (file)
                 (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");
             }