mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
776fc4462c
commit
e7975ec71f
2 files changed
+1
-78
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user