21 lines
577 B
TypeScript
Raw Normal View History

2019-08-30 07:04:28 +00:00
import ToolTip from "./Elements/tool-tip/tool-tip"
import SVGIcon from "./Elements/svg-icon/svg-icon"
export function register() {
if(!("customElements" in window)) {
console.warn("Web components not supported in your current browser")
return
}
// Custom element names must have a dash in their name
const elements = new Map<string, Function>([
["tool-tip", ToolTip],
["svg-icon", SVGIcon]
])
// Register all custom elements
for(const [tag, definition] of elements.entries()) {
2020-04-13 14:56:15 +00:00
window.customElements.define(tag, definition as CustomElementConstructor)
2019-08-30 07:04:28 +00:00
}
2019-11-17 09:44:30 +00:00
}