修复运行时未初始化

This commit is contained in:
yhh
2020-07-23 19:28:01 +08:00
parent 79c5d6990c
commit d4c244daf5
18 changed files with 283 additions and 303 deletions

View File

@@ -17,7 +17,12 @@ module es {
public static readonly logSnapDuration = 120;
public static readonly barPadding = 2;
public static readonly autoAdjustDelay = 30;
public static Instance: TimeRuler;
private static _instance;
public static get Instance(): TimeRuler{
if (!this._instance)
this._instance = new TimeRuler();
return this._instance;
}
private _frameKey = 'frame';
private _logKey = 'log';
@@ -56,7 +61,6 @@ module es {
private _frameAdjust: number;
constructor() {
TimeRuler.Instance = this;
this._logs = new Array<FrameLog>(2);
for (let i = 0; i < this._logs.length; ++i)
this._logs[i] = new FrameLog();