123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import registerHooks from "../../../core/utils/registerHooks";
- import { globalExt } from "../../../core/utils/constants";
- import monitor from "../components/utils/alipayLogger";
- function wait(callback, time) {
- const { globalData } = getApp();
- if (time >= 5 || globalData.monitorPid) {
- callback(globalData);
- } else {
- setTimeout(() => {
- wait(callback, time + 1);
- }, 1000);
- }
- }
- registerHooks({
- async onAppLaunch(options) {
- wait(({ monitorPid }) => {
- try {
- monitor.init({
- pid: monitorPid || globalExt.pid,
- // eslint-disable-next-line no-undef
- options,
- sample: 1,
- autoReportApi: false,
- autoReportPage: true,
- // Http请求返回数据中状态码字段名称
- code: ["code"],
- // Http返回数据中的error message字段名称
- msg: ["msg"],
- miniVersion: globalExt.miniVersion || "0.0.56",
- });
- monitor.setCommonInfo({
- tag: this.globalData.appId,
- });
- } catch (error) {
- console.error(error);
- }
- }, 0);
- },
- });
|