custom-libraries
v0.1.0
Published
A customElements like registry for user-land libraries
Downloads
3
Maintainers
Readme
customLibraries
Social Media Photo by Matteo Maretto on Unsplash
A customElements like registry for user-land libraries.
Based on Some Web Components Hints post idea, but without polluting the customElements
registry.
Compatible down to IE9 (with setTimeout
polyfill) and every other browser, for a total of 272 bytes once minified and gzipped.
import {define, get, whenDefined} from 'custom-libraries';
// const {define, get, whenDefined} = require('custom-libraries');
// <script src="//unpkg.com/custom-libraries">customLibraries</script>
whenDefined('my-lib').then(myLib => {
// myLib is defined and passed along
// get('my-lib') === myLib
});
setTimeout(() => {
define('my-lib', {any: 'value'});
});