Commit 717ef537 authored by fanxuehui's avatar fanxuehui

feat(types):

parent feb99f13
export interface MProps {
system: string;
userIdentifier: string;
env: "dev" | "prod";
log: boolean;
}
export declare class Monitor {
constructor(props: MProps);
}
\ No newline at end of file
import * as rrweb from "rrweb";
import TracksWorker from "./tracks.worker";
import utils from './utils';
import utils from "./utils";
export default class Monitor {
rrwebHandler = null;
tracksWorker = new TracksWorker();
constructor(props) {
console.log('初始化');
constructor({ system = "unknow", userIdentifier = "unknow", env = "prod", log = false }) {
console.log("初始化");
this.tracksWorker.postMessage({
type: "init",
payload: {
system: props.system,
config: props.config
}
system,
userIdentifier,
env,
log,
},
});
}
resetRrwebHandler() {
......
......@@ -6,18 +6,14 @@
export const dataWrapper = (extraData, event) => {
return {
...extraData,
track: event
}
track: event,
};
};
/**
* 是否打印日志
* @param {*} logMes
* @param {boolean} log
*/
export const log = (log, logMes, logContent) => {
if( log) {
return console.log(logMes, logContent);
} else {
return;
}
export const log = (log, ...rest) => {
console.log(rest);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment