|
@@ -1,7 +1,8 @@
|
|
|
import { ILoaderPlugin } from "./loaderPlugin";
|
|
|
import { telemetryManager } from "../../managers/telemetryManager";
|
|
|
import { ViewerModel } from "../../model/viewerModel";
|
|
|
-import { Tools, ISceneLoaderPlugin, ISceneLoaderPluginAsync } from "babylonjs";
|
|
|
+import { ISceneLoaderPlugin, ISceneLoaderPluginAsync } from "babylonjs";
|
|
|
+import { PrecisionDate } from "babylonjs/Misc/precisionDate";
|
|
|
|
|
|
export class TelemetryLoaderPlugin implements ILoaderPlugin {
|
|
|
|
|
@@ -12,19 +13,19 @@ export class TelemetryLoaderPlugin implements ILoaderPlugin {
|
|
|
|
|
|
public onInit(loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync, model: ViewerModel) {
|
|
|
this._model = model;
|
|
|
- this._loadStart = Tools.Now;
|
|
|
+ this._loadStart = PrecisionDate.Now;
|
|
|
}
|
|
|
|
|
|
public onLoaded(model: ViewerModel) {
|
|
|
telemetryManager.broadcast("Model Loaded", model.getViewerId(), {
|
|
|
model: model,
|
|
|
- loadTime: Tools.Now - this._loadStart
|
|
|
+ loadTime: PrecisionDate.Now - this._loadStart
|
|
|
});
|
|
|
telemetryManager.flushWebGLErrors(model.rootMesh.getEngine(), model.getViewerId());
|
|
|
}
|
|
|
|
|
|
public onError(message: string, exception: any) {
|
|
|
- this._loadEnd = Tools.Now;
|
|
|
+ this._loadEnd = PrecisionDate.Now;
|
|
|
telemetryManager.broadcast("Load Error", this._model.getViewerId(), {
|
|
|
model: this._model,
|
|
|
loadTime: this._loadEnd - this._loadStart
|
|
@@ -34,7 +35,7 @@ export class TelemetryLoaderPlugin implements ILoaderPlugin {
|
|
|
}
|
|
|
|
|
|
public onComplete() {
|
|
|
- this._loadEnd = Tools.Now;
|
|
|
+ this._loadEnd = PrecisionDate.Now;
|
|
|
telemetryManager.broadcast("Load Complete", this._model.getViewerId(), {
|
|
|
model: this._model,
|
|
|
loadTime: this._loadEnd - this._loadStart
|