he-lib

0.1.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    19
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    19
  • 0.1.0
    17
  • 0.0.0
    16

Package Sidebar

Install

npm i he-lib

Weekly Downloads

49

Version

0.1.1

License

ISC

Unpacked Size

29.5 kB

Total Files

9

Last publish

Collaborators

  • webreflection