diff --git a/packages/canyon-platform/src/collect.js b/packages/canyon-platform/src/collect.js new file mode 100644 index 00000000..e69de29b diff --git a/packages/canyon-platform/src/collect.ts b/packages/canyon-platform/src/collect.ts deleted file mode 100644 index a14bb33f..00000000 --- a/packages/canyon-platform/src/collect.ts +++ /dev/null @@ -1,39 +0,0 @@ -// // 要收集的数据 -// // const dataToSend = JSON.stringify(); -// // window.__canyon__ = {} -// // window.__coverage__ = {} -// // 数据收集函数 -// // @ts-ignore -// if (window.__canyon__ && window.__coverage__) { -// function collectData(t) { -// navigator.sendBeacon( -// "/api/coverage/collect", -// JSON.stringify({ -// // @ts-ignore -// ...window.__canyon__, -// // @ts-ignore -// coverage: window.__coverage__, -// reportID: t, -// }), -// ); -// } -// -// // beforeunload 事件:当用户即将离开页面时触发 -// window.addEventListener("beforeunload", () => { -// collectData("beforeunload"); -// }); -// -// // unload 事件:在页面完全卸载前触发 -// window.addEventListener("unload", () => { -// collectData("unload"); -// }); -// -// // visibilitychange 事件:当页面变为不可见(如切换到其他标签页)时触发 -// document.addEventListener("visibilitychange", () => { -// if (document.visibilityState === "hidden") { -// collectData("visibilitychange"); -// } -// }); -// } else { -// console.log("no canyon no coverage"); -// } diff --git a/packages/canyon-platform/src/main.tsx b/packages/canyon-platform/src/main.tsx index 7998bb59..4d16da48 100644 --- a/packages/canyon-platform/src/main.tsx +++ b/packages/canyon-platform/src/main.tsx @@ -3,7 +3,7 @@ import "./useWorker.ts"; import "./i18n.ts"; import "antd/dist/reset.css"; import "./index.css"; -// import "./collect.ts"; +import "./collect.js"; import { ApolloClient,