UNPKG

uni-app-arms-sdk

Version:

UniApp ARMS监控SDK,提供应用性能监控、错误追踪、API监控等功能

34 lines (26 loc) 1.01 kB
// index.js import { initArms, getArms } from './lib/arms-instance'; import { setupErrorHandler } from './lib/error-handler'; // import { startApiReport, endApiReport } from './lib/api-reporter'; import { reportApiSuccess, reportApiError } from './lib/request'; import { armsPvMixin } from './mixins/pv'; // 导出ARMS实例获取方法(供外部直接使用ARMS功能) export { getArms }; // // 导出API计时监控方法(适用于需要精确计时的场景) // export { startApiReport, endApiReport }; // 导出API监控方法 export { reportApiSuccess, reportApiError }; // 导出PV mixin export { armsPvMixin }; // 导出install方法,作为Vue插件 export default { install(Vue, options) { // 1. 初始化ARMS实例 const arms = initArms(options); // 2. 将实例挂载到Vue原型上,方便自定义事件上报 Vue.prototype.$arms = arms; // 3. 设置全局错误捕获 setupErrorHandler(Vue); console.log('My UniApp ARMS SDK initialized.'); } };