From bf280c6fa1e46d084fc8f20323164816fad4076f Mon Sep 17 00:00:00 2001 From: liujuping Date: Thu, 26 May 2022 18:24:02 +0800 Subject: [PATCH] fix: fix monitor utils incorrect assignment method --- packages/editor-core/src/utils/monitor.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/editor-core/src/utils/monitor.ts b/packages/editor-core/src/utils/monitor.ts index 80313a55b..0889d4565 100644 --- a/packages/editor-core/src/utils/monitor.ts +++ b/packages/editor-core/src/utils/monitor.ts @@ -1,6 +1,6 @@ export class Monitor { fn = (params: any) => { - const { AES } = window as any; + const { AES = {} } = window as any; if (typeof AES.log === 'function') { const { p1 = '', p2 = '', p3 = '', p4 = 'OTHER', ...rest } = params || {}; AES.log('event', { @@ -13,10 +13,6 @@ export class Monitor { } }; - constructor() { - (window as any).AES = (window as any).AES || {}; - } - register(fn: () => any) { if (typeof fn === 'function') { this.fn = fn; @@ -30,7 +26,7 @@ export class Monitor { } setConfig(key: string | object, value?: string): void { - const { AES } = window as any; + const { AES = {} } = window as any; if (typeof AES?.setConfig !== 'function') { return; }