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 * as rrweb from "rrweb";
import TracksWorker from "./tracks.worker"; import TracksWorker from "./tracks.worker";
import utils from './utils'; import utils from "./utils";
export default class Monitor { export default class Monitor {
rrwebHandler = null; rrwebHandler = null;
tracksWorker = new TracksWorker(); tracksWorker = new TracksWorker();
constructor(props) { constructor({ system = "unknow", userIdentifier = "unknow", env = "prod", log = false }) {
console.log('初始化'); console.log("初始化");
this.tracksWorker.postMessage({ this.tracksWorker.postMessage({
type: "init", type: "init",
payload: { payload: {
system: props.system, system,
config: props.config userIdentifier,
} env,
log,
},
}); });
} }
resetRrwebHandler() { resetRrwebHandler() {
......
...@@ -6,18 +6,14 @@ ...@@ -6,18 +6,14 @@
export const dataWrapper = (extraData, event) => { export const dataWrapper = (extraData, event) => {
return { return {
...extraData, ...extraData,
track: event track: event,
} };
}; };
/** /**
* 是否打印日志 * 是否打印日志
* @param {*} logMes * @param {boolean} log
*/ */
export const log = (log, logMes, logContent) => { export const log = (log, ...rest) => {
if( log) { console.log(rest);
return console.log(logMes, logContent);
} else {
return;
}
}; };
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