Page MenuHomeSealhub

registry.ts
No OneTemporary

registry.ts

import { Component, ComponentConstructor } from "./component.js";
export class Registry {
map: Map<string, Component> = new Map();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
add(type: string, component: ComponentConstructor<any>) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
this.map.set(type, new component());
}
get(type: string): Component | null {
const ret = this.map.get(type);
return ret ? ret : null;
}
getAll(): Record<string, Component> {
return Object.fromEntries(this.map.entries());
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 15:15 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
599872
Default Alt Text
registry.ts (565 B)

Event Timeline