mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Create knot on link double click
This commit is contained in:
25
js/element/ElementFactory.js
Normal file
25
js/element/ElementFactory.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @typedef {new (...args) => IElement} ElementConstructor
|
||||
* @typedef {import("./IElement").default} IElement
|
||||
*/
|
||||
|
||||
export default class ElementFactory {
|
||||
|
||||
/** @type {Map<String, ElementConstructor>} */
|
||||
static #elementConstructors = new Map()
|
||||
|
||||
/**
|
||||
* @param {String} tagName
|
||||
* @param {ElementConstructor} entityConstructor
|
||||
*/
|
||||
static registerElement(tagName, entityConstructor) {
|
||||
ElementFactory.#elementConstructors.set(tagName, entityConstructor)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} tagName
|
||||
*/
|
||||
static getConstructor(tagName) {
|
||||
return ElementFactory.#elementConstructors.get(tagName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user