Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2020-07-03 17:33:59 +03:00
1 parent 776fc4462c
commit e7975ec71f
2 files changed
+1 -78

No files matched your search

+1 -5
View File
@@ -9,7 +9,7 @@
export class Singleton {
private static instances = new WeakMap<object, Singleton>();
// todo: figure out how to infer child class type + arguments
// todo: figure out how to infer child class + arguments types
static getInstance<T extends Singleton>(...args: any[]): T {
if (!Singleton.instances.has(this)) {
Singleton.instances.set(this, Reflect.construct(this, args));
@@ -20,8 +20,4 @@ export class Singleton {
static resetInstance() {
Singleton.instances.delete(this);
}
protected constructor() {
return this;
}
}