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

Version Path
clapton-0.0.13 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.12 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.11 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.10 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.9 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.8 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.7 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.6 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.5 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.4 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.3 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.2 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.1 lib/clapton/javascripts/src/dom/update-component.ts