Sha256: 1061a7326b2410d4389c83a0925eee299de3215aeb6309fd54ca70ef65d371c5
Contents?: true
Size: 678 Bytes
Versions: 12
Compression:
Stored size: 678 Bytes
Contents
import { updateComponent } from "dom/update-component"; export const initializeInputs = () => { const inputElements = document.querySelectorAll("[data-attribute]"); inputElements.forEach((element: any) => { const attribute = element.getAttribute("data-attribute"); const component = element.closest(`[data-component]`) as HTMLElement; const state = JSON.parse(component.getAttribute("data-state") || "{}"); if (!attribute || !component) return; if (element.tagName === "INPUT") { element.addEventListener("input", (event: Event) => { updateComponent(component, state, attribute, event.target as HTMLInputElement); }); } }); };
Version data entries
12 entries across 12 versions & 1 rubygems