Sha256: b526318f97951679a0674e891334423b109765d42f4f1332898030136759a01f
Contents?: true
Size: 693 Bytes
Versions: 12
Compression:
Stored size: 693 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", async (event: Event) => { await updateComponent(component, state, attribute, event.target as HTMLInputElement); }); } }); };
Version data entries
12 entries across 12 versions & 1 rubygems