mirror of
https://github.com/RocketChat/Rocket.Chat.git
synced 2025-12-28 06:47:25 +00:00
26 lines
495 B
TypeScript
26 lines
495 B
TypeScript
export type Maybe<T> = T | null | undefined;
|
|
|
|
export const AppObjectRegistry = new class {
|
|
registry: Record<string, unknown> = {};
|
|
|
|
public get<T>(key: string): Maybe<T> {
|
|
return this.registry[key] as Maybe<T>;
|
|
}
|
|
|
|
public set(key: string, value: unknown): void {
|
|
this.registry[key] = value;
|
|
}
|
|
|
|
public has(key: string): boolean {
|
|
return key in this.registry;
|
|
}
|
|
|
|
public delete(key: string): void {
|
|
delete this.registry[key];
|
|
}
|
|
|
|
public clear(): void {
|
|
this.registry = {};
|
|
}
|
|
}();
|