diff --git a/apps/restaurant-cashier/app.js b/apps/restaurant-cashier/app.js index ca470a0..1c07030 100644 --- a/apps/restaurant-cashier/app.js +++ b/apps/restaurant-cashier/app.js @@ -59,7 +59,11 @@ export const createApp = ({ router }) => { }); }; - const _define = (tag, comp, ...rest) => define(tag, withRoot(comp), ...rest); + const _define = (tag, comp, ...rest) => { + if (!customElements.get(tag)) { + define(tag, withRoot(comp), ...rest); + } + }; _define('ui-icon', UIIcon, { shadow: { mode: 'open' }, diff --git a/packages/core/src/define.js b/packages/core/src/define.js index 441a532..f9d95a8 100644 --- a/packages/core/src/define.js +++ b/packages/core/src/define.js @@ -1,18 +1,15 @@ import { component } from './component.js'; -export const define = (tag, coroutine, opts = {}) => { - if (!customElements.get(tag)) { - customElements.define( - tag, - component(coroutine, { - observedAttributes: opts.observedAttributes, - Klass: classElementMap[opts?.extends] ?? HTMLElement, - ...opts, - }), - opts, - ); - } -}; +export const define = (tag, coroutine, opts = {}) => + customElements.define( + tag, + component(coroutine, { + observedAttributes: opts.observedAttributes, + Klass: classElementMap[opts?.extends] ?? HTMLElement, + ...opts, + }), + opts, + ); const classElementMap = { label: HTMLLabelElement,