UNPKG

@umbraco-ui/uui-base

Version:

This is a base dependency for Umbraco UI components. It contains mixins, animations, abstract base classes, UUIEvent base class, and universal types for properties shared by different components

18 lines (16 loc) 541 B
function defineElement(name, options) { return (constructor) => { const isValidElementName = name.indexOf("-") > 0; if (isValidElementName === false) { console.error( `${name} is not a valid custom element name. A custom element name should consist of at least two words separated by a hyphen.` ); return; } const existingElement = window.customElements.get(name); if (!existingElement) { window.customElements.define(name, constructor, options); } }; } export { defineElement };