Add custom elements
This commit is contained in:
parent
c7541db1d9
commit
e8bf135424
5 changed files with 205 additions and 1 deletions
22
module/apps/elements/_index.mjs
Normal file
22
module/apps/elements/_index.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { OFTIcon } from "./Icon.mjs";
|
||||
import { OFTSVGLoader } from "./SVGLoader.mjs";
|
||||
|
||||
const components = [
|
||||
OFTSVGLoader,
|
||||
OFTIcon,
|
||||
];
|
||||
|
||||
export function registerCustomComponents() {
|
||||
(CONFIG.CACHE ??= {}).componentListeners ??= [];
|
||||
for (const component of components) {
|
||||
if (!window.customElements.get(component.elementName)) {
|
||||
window.customElements.define(
|
||||
component.elementName,
|
||||
component,
|
||||
);
|
||||
if (component.formAssociated) {
|
||||
CONFIG.CACHE.componentListeners.push(component.elementName);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue