0.1.17 • Published 5 years ago

aqa-report-sdk v0.1.17

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

小爱快应用打点sdk:

使用方法:

  • 安装依赖:
        npm install --save aqa-report-sdk
  • 引用reportConnect

        import { reportConnect } from 'aqa-report-sdk'
    
        const appComponent =
            showMenu: util.showMenu,
            createShortcut: util.createShortcut
        }
        export default reportConnect.call(this, {appComponent, {
            type: 'app'
        })

    reportConnect的参数是:

    • 1.app或页面script脚本实例
    • 默认配置:{ isImmediately 是否实时上传,默认为true,当传入为false时,在组件销毁时上传所有打点 type实例类型,可以传入app或者page,默认是page,只有在 type===app会上传apponCreate生命周期的耗时,type===page会上传页面onInit onReady, onShow生命周期的耗时。 debug 是否打印日志,默认为true }
  • 引用customReport 自定义打点

    customReport({
        reportKey: 'pageOnProgress1',
        timestamp: new Date().getTime(),
        isImmediately: false
    })

    参数:

    • reportKey为必传参数,可以为pageOnProgress1pageOnProgress2pageOnProgress3,即用户自定义时间节点
    • timestamp为必传参数,即当前时间戳

注意:

  • 当在真实的环境上传数据时,请设置环境变量和常量``NODE_ENVproduction。步骤为

    • 在根目录创建config文件夹
    • config目录下面创建
    • webpack.config.js中写入如下代码

          const webpack = require('webpack')
      
          function postHook (webpackConf, defaults, options) {
              webpackConf.plugins.push(
                  // 定义环境变量
                  new webpack.DefinePlugin({
                      // 增加环境变量
                      NODE_ENV:  JSON.stringify(process.env.NODE_ENV),
                  })
              )
          }
      
          module.exports = {
              postHook
          }
    • 安装cross-env

    • 在package.json写入
          "release": "cross-env NODE_ENV=production hap release",
          "watch": "cross-env NODE_ENV=preview hap watch"
0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago