From 2eb5b89124506ed9c5dadf76be391db7f39945ec Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Tue, 18 Jul 2023 22:08:01 +0200 Subject: [PATCH] feat: initial registry class --- src/registry.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/registry.ts diff --git a/src/registry.ts b/src/registry.ts new file mode 100644 index 0000000..26ee2d8 --- /dev/null +++ b/src/registry.ts @@ -0,0 +1,12 @@ +export class SerializedRegistry { + private _registeredIds: string[] + constructor() {} + get registeredIds() { + return this._registeredIds; + } + public register(id: string) { + if (this._registeredIds.includes(id)) + throw Error(`${id} is already used`) + this._registeredIds.push(id); + } +} \ No newline at end of file