drab
Version:
Interactivity for You
12 lines (11 loc) • 345 B
JavaScript
/**
* Define a custom element to the registry. Checks if the element is
* defined and then names the element.
*
* @param name name of the custom element
* @param Constructor custom element constructor
*/
export const define = (name, Constructor) => {
if (!customElements.get(name))
customElements.define(name, Constructor);
};