@rocket.chat/apps-engine
Version:
The engine code for the Rocket.Chat Apps which manages, runs, translates, coordinates and all of that.
27 lines (19 loc) • 556 B
text/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 = {};
}
}