How to use the skatejs.withChildren function in skatejs

To help you get started, we’ve selected a few skatejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skatejs / skatejs / test / ts / mixins / with-children.tsx View on Github external
import { withChildren } from 'skatejs';

class WithChildren extends withChildren() {
  childrenUpdated() {
    const len = this.children.length;
    this.attachShadow({ mode: 'open' }).innerHTML = `This element has ${len} ${
      len === 1 ? 'child' : 'children'
    }!`;
  }
}

customElements.define('with-children', WithChildren);
github skatejs / skatejs / site / pages / mixins / __samples__ / with-children / 1.js View on Github external
import { withChildren } from 'skatejs';

class WithChildren extends withChildren() {
  childrenUpdated() {
    const len = this.children.length;
    this.attachShadow({
      mode: 'open'
    }).innerHTML = `This element has ${len} ${
      len === 1 ? 'child' : 'children'
    }!`;
  }
}

customElements.define('with-children1', WithChildren);