Sha256: c34a6b7d2597e8cb42dfbc3359aebcedb187f57f2a8c736d387fadf1084a2b08

Contents?: true

Size: 471 Bytes

Versions: 3

Compression:

Stored size: 471 Bytes

Contents

import morphdom from "morphdom";

export const updateComponent = async (component: HTMLElement, state: any, property: string, target: HTMLInputElement) => {
  state[property] = target.value;
  const componentName = component.dataset.component as string;
  const module = await import(`${componentName}`);
  const ComponentClass = module[componentName] as any;
  const instance = new ComponentClass(state, component.dataset.id);
  morphdom(component, instance.render);
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clapton-0.0.17 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.16 lib/clapton/javascripts/src/dom/update-component.ts
clapton-0.0.15 lib/clapton/javascripts/src/dom/update-component.ts