UNPKG

turbopug

Version:

No-junk JS component library with insignificant weight. All in one mush: Web-Components, Localization, Routing, Reactive binding, Debounce, Unique IDs, PSW hashing

17 lines 589 B
export default class Comp extends HTMLElement { constructor() { super(); setTimeout(() => { if (typeof this.render === 'function') { this.attachShadow({mode: 'open'}); const helper = document.createElement('div'); helper.innerHTML = this.render(); const elements = [...helper.children]; if (typeof this.bind === 'function') { this.bind(...elements); } this.shadowRoot.append(...elements); } }, 0); } }