auto-point 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/AP/auto_point.js +5 -4
  2. package/package.json +1 -1
package/AP/auto_point.js CHANGED
@@ -167,10 +167,10 @@
167
167
  })
168
168
  // 挂载页面离开事件监听
169
169
  window.addEventListener('visibilitychange', () => {
170
- if (navigator && navigator.sendBeacon && document.visibilityState === 'hidden') {
171
- let type = "pagehide"
172
- let value = "hidden"
173
- let describe = "Webpage hidden point"
170
+ if (navigator && navigator.sendBeacon) {
171
+ let type = "visibilitychange"
172
+ let value = document.visibilityState
173
+ let describe = "Webpage visibility state is changed to: " + document.visibilityState
174
174
  this.#add_point(this.#create_active_point_data(type, value, describe))
175
175
  this.#send()
176
176
  }
@@ -196,6 +196,7 @@
196
196
  item.apply(this)
197
197
  }
198
198
  })
199
+ this.#POINT_LAST_SEND_TIME = new Date().getTime() // 更新最后发送时间
199
200
  navigator.sendBeacon(this.#SERVER, JSON.stringify(this.#POINT_LIST));
200
201
  // 发送后清空埋点列表数据
201
202
  this.#POINT_LIST = new Array()
package/package.json CHANGED
@@ -13,5 +13,5 @@
13
13
  "scripts": {
14
14
  "test": "echo \"Error: no test specified\" && exit 1"
15
15
  },
16
- "version": "0.0.19"
16
+ "version": "0.0.21"
17
17
  }