npm.io
0.1.3 • Published 6 years ago

we-lib

Licence
ISC
Version
0.1.3
Deps
1
Size
26 kB
Vulns
0
Weekly
0
Stars
1

we-lib

A customElements indirection to have wicked-elements library a part, without needing to bundle it within components.

// vanilla
customElements.whenDefined('we-lib').then(() => {
  const {define} = customElements.get('we-lib');
  define('.my-component', {
    init() {
      console.log('my-component is ready');
    }
  });
});

// with helper
import when from 'once-defined';
when('we-lib').then(({define}) => {
  define('.another-component', {
    init() {
      console.log('another-component is ready');
    }
  });
});

Previous Work

Keywords