aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-08-07 00:00:00 +0000
committertdro <tdro@noreply.example.com>2024-08-07 00:00:00 +0000
commitb55091cb573031e609b0f369e0e86619745e40a4 (patch)
tree0d3ade4ab5d6847677b35378e7e0235f2ffc8797
parentdb0e69fb286d03d72e73b79e10a682980a5c7429 (diff)
downloadcanory-b55091cb573031e609b0f369e0e86619745e40a4.tar.gz
canory-b55091cb573031e609b0f369e0e86619745e40a4.tar.bz2
canory-b55091cb573031e609b0f369e0e86619745e40a4.zip
static/js/forms: First change wins
-rw-r--r--assets/js/index.js2
-rw-r--r--static/js/forms.ts4
2 files changed, 6 insertions, 0 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 2b61453..9efad91 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -627,6 +627,8 @@
} else state.value = localStorage[state.id];
}
if (sync) self.dispatchEvent(storage);
+ if (state.dataset.listener === "active") break;
+ state.setAttribute("data-listener", "active");
state.addEventListener("change", function(event) {
localStorage[event.target.id] = event.target.value;
const group = document.querySelectorAll("input[name='".concat(event.target.name, "']"));
diff --git a/static/js/forms.ts b/static/js/forms.ts
index b7b4b44..bfbde81 100644
--- a/static/js/forms.ts
+++ b/static/js/forms.ts
@@ -28,6 +28,10 @@
if (sync) self.dispatchEvent(storage);
+ if (state.dataset.listener === "active") break;
+
+ state.setAttribute("data-listener", "active");
+
state.addEventListener("change", function (event) {
// console.log("INFO: STATE:", event.target);