{"size": 996, "ext": "js", "max_stars_repo_path": "library/statistics/TridentStat.js", "max_stars_repo_name": "yatessss/WeTrident", "max_stars_repo_stars_event_min_datetime": "2021-03-08T02:14:26.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-08T02:14:26.000Z", "max_issues_repo_path": "library/statistics/TridentStat.js", "max_issues_repo_name": "yatessss/WeTrident", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "library/statistics/TridentStat.js", "max_forks_repo_name": "yatessss/WeTrident", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9, "max_line_length": 67, "alphanum_fraction": 0.718875502}
class TridentStat {
  // 控制用户点击是否自动上报
  static pressAutoStat = true
  // 控制网络请求是否自动上报，默认为false
  static httpRequestAutoReport = false

  static StatType = {
    sceneChange: 'sceneChange',
    userAction: 'userAction',
    httpRequest: 'httpRequest',

    // nativeError: 'nativeError',
    renderError: 'renderError',
    unhandlePromise: 'unhandlePromise',
  }
  static statEventHandler = (statEvent) => statEvent

  static setOnStatEventHandler (customStatEventHandler) {
    if (typeof customStatEventHandler === 'function') {
      this.statEventHandler = (statData) => {
        customStatEventHandler(statData)
      }
    }
  }

  static emitStatEvent(statData) {
    this.statEventHandler && this.statEventHandler(statData)
  }

  static setPressAutoReport (pressAutoReport = true) {
    this.pressAutoStat = pressAutoReport
  }

  static setHttpRequestAutoReport (httpRequestAutoReport = false) {
    this.httpRequestAutoReport = httpRequestAutoReport
  }
}

export default TridentStat
