Page MenuHomeSealhub

registry.ts
No OneTemporary

Authored By
Unknown
Size
565 B
Referenced Files
None
Subscribers
None

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
application/javascript
Expires
Fri, Nov 27, 16:38 (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1229143
Default Alt Text
registry.ts (565 B)

Event Timeline