npm.io
0.1.1 • Published 6 years ago

he-lib

Licence
ISC
Version
0.1.1
Deps
1
Size
29 kB
Vulns
0
Weekly
0
Stars
1

he-lib

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

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

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

Previous Work

Keywords