feat: initial registry class
This commit is contained in:
parent
c58b3aa152
commit
2eb5b89124
1 changed files with 12 additions and 0 deletions
12
src/registry.ts
Normal file
12
src/registry.ts
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue