fix: fix monitor utils incorrect assignment method

This commit is contained in:
liujuping 2022-05-26 18:24:02 +08:00 committed by LeoYuan 袁力皓
parent 75626d877d
commit bf280c6fa1

View File

@ -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;
}