mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
19 lines
521 B
JavaScript
Executable File
19 lines
521 B
JavaScript
Executable File
export default class ElementFactory {
|
|
|
|
/** @type {Map<String, IElementConstructor>} */
|
|
static #elementConstructors = new Map()
|
|
|
|
/**
|
|
* @param {String} tagName
|
|
* @param {IElementConstructor} entityConstructor
|
|
*/
|
|
static registerElement(tagName, entityConstructor) {
|
|
ElementFactory.#elementConstructors.set(tagName, entityConstructor)
|
|
}
|
|
|
|
/** @param {String} tagName */
|
|
static getConstructor(tagName) {
|
|
return ElementFactory.#elementConstructors.get(tagName)
|
|
}
|
|
}
|