Sha256: 2a465ba543ceeed9abdc4fd2cb6da49f2ff3b84a8d415f4e156fe2fcfa399460
Contents?: true
Size: 497 Bytes
Versions: 13
Compression:
Stored size: 497 Bytes
Contents
import morphdom from "morphdom"; export const updateComponent = (component: HTMLElement, state: any, property: string, target: HTMLInputElement) => { state[property] = target.value; component.setAttribute("data-state", JSON.stringify(state)); const componentName = component.getAttribute("data-component") as string; const ComponentClass = window[componentName as any] as any; const instance = new ComponentClass(state, component.dataset.id); morphdom(component, instance.render); };
Version data entries
13 entries across 13 versions & 1 rubygems