mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
feat: add Monitor
This commit is contained in:
parent
fecf34d0d7
commit
f915d19dba
@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* 黄金令箭埋点
|
|
||||||
* @param {String} gmKey 为黄金令箭业务类型
|
|
||||||
* @param {Object} params 参数
|
|
||||||
* @param {String} logKey 属性串
|
|
||||||
*/
|
|
||||||
export function goldlog(gmKey: string, params: object = {}, logKey: string = 'other'): void {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
export * from './get-public-path';
|
export * from './get-public-path';
|
||||||
export * from './goldlog';
|
export * from './monitor';
|
||||||
export * from './obx';
|
export * from './obx';
|
||||||
export * from './request';
|
export * from './request';
|
||||||
export * from './focus-tracker';
|
export * from './focus-tracker';
|
||||||
|
|||||||
45
packages/editor-core/src/utils/monitor.ts
Normal file
45
packages/editor-core/src/utils/monitor.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
class Monitor {
|
||||||
|
fn = (params: any) => {
|
||||||
|
const { AES } = window as any;
|
||||||
|
if (typeof AES.log === 'function') {
|
||||||
|
const { p1, p2, p3, p4 = 'OTHER', ...rest } = params || {};
|
||||||
|
AES.log('event', {
|
||||||
|
p1,
|
||||||
|
p2,
|
||||||
|
p3,
|
||||||
|
p4,
|
||||||
|
...rest,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
(window as any).AES = (window as any).AES || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
register(fn: () => any) {
|
||||||
|
if (typeof fn === 'function') {
|
||||||
|
this.fn = fn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log(params: any) {
|
||||||
|
if (typeof this.fn === 'function') {
|
||||||
|
this.fn(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setConfig(key: string | object, value?: string): void {
|
||||||
|
const { AES } = window as any;
|
||||||
|
if (typeof AES?.setConfig !== 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof key === 'string' && value) {
|
||||||
|
AES.setConfig(key, value);
|
||||||
|
} else if (typeof key === 'object') {
|
||||||
|
AES.setConfig(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new Monitor();
|
||||||
Loading…
x
Reference in New Issue
Block a user