1.0.4 • Published 2 years ago

frontend-monitor-vue v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

#用法

import monitor from "frontend-monitor-vue";

Vue.use(
  monitor,
  {
    // 配置storage时,可以配置如下字段
    storage: "indexDB",
    // indexDB 配置
    // indexDB.open(dbName, dbVersion)
    dbName: "db_name", // 默认值:db_name
    dbVersion: 1, // 默认值:1
    //db.createObjectStore(tableName, tableKey)
    tableName: "table_name", //  默认值: "table_name"
    tableKey: { autoIncrement: true }, // 主键 eg. {keypath: 'obj.fieldname'} , 默认值: { autoIncrement: true }
    // 表索引
    indexes: [], //表索引 eg. [{name: 'indexname', field: 'obj.fieldname', unique: false}] 默认值:[]
  },
  (config) => {
    config
      // 注册数据收集回调函数
      .tap("info", () => {
        // 返回 需要收集的信息
        // 收集的所有信息将在调用tapCallback注册的回调函数时通过data字段返回
        return {
          xxx: 123,
          yyy: 456,
        };
      })
      // 注册返回所有被收集数据的回调函数
      // data包含所有tap注册回调的返回值
      // cb回调 如果配置了本地storage逻辑,可以调用cb删除本次存储的数据记录
      .tapCallback((error, data, cb) => {
        console.log("@@@@", data);
        // todo 调接口

        // 如果有配置storage,删除本次tapCallback回调创建的storage记录
        cb && cb();
      });
  }
);
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago