[add] first
This commit is contained in:
20
assets/scripts/core/pattern/singleton.ts
Normal file
20
assets/scripts/core/pattern/singleton.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
export class Singleton {
|
||||
|
||||
private static _instance: any = null;
|
||||
|
||||
public static get Instance() {
|
||||
if (!this._instance) {
|
||||
this._instance = new this();
|
||||
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
public init() {}
|
||||
|
||||
public clear() {
|
||||
Singleton._instance = null;
|
||||
}
|
||||
|
||||
}
|
||||
9
assets/scripts/core/pattern/singleton.ts.meta
Normal file
9
assets/scripts/core/pattern/singleton.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f3e08382-b420-4a5d-8f37-0a3326c65402",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user