You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
586 B
28 lines
586 B
7 months ago
|
import type { Component } from 'vue';
|
||
|
|
||
|
class FieldRegistry {
|
||
|
private static readonly _instance: FieldRegistry = new FieldRegistry();
|
||
|
private readonly _map: Map<string, Component>;
|
||
|
constructor() {
|
||
|
this._map = new Map<string, Component>();
|
||
|
}
|
||
|
|
||
|
push(compName: string, component: Component) {
|
||
|
this._map.set(compName, component);
|
||
|
}
|
||
|
|
||
|
static get instance() {
|
||
|
return this._instance;
|
||
|
}
|
||
|
|
||
|
get(compName: string) {
|
||
|
return this._map.get(compName);
|
||
|
}
|
||
|
|
||
|
get map() {
|
||
|
return this._map;
|
||
|
}
|
||
|
}
|
||
|
const fieldRegistry = FieldRegistry.instance;
|
||
|
export { fieldRegistry };
|