@tmsfe/tms-core 0.0.31 → 0.0.32

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -210,6 +210,11 @@ function getCloudReport() {
210
210
  return CloudReport;
211
211
  }
212
212
 
213
+ wx.onAppShow((options) => {
214
+ // 避免vendor分包加载太慢而错过onAppShow
215
+ wx.tmsAppShowOptions = options;
216
+ });
217
+
213
218
  const api = {
214
219
  isProxy: true, // 方便定位问题时判断是否proxy
215
220
  initProxy,
package/src/report.js CHANGED
@@ -299,7 +299,7 @@ const cache = (reportData, reportNow, locPoi = true) => {
299
299
  }
300
300
  return Promise.all(task)
301
301
  .then(async (deviceData) => {
302
- // 先对上报数据进行预处理
302
+ // 先对上报数据进行预处理
303
303
  const result = await formatReportData(reportData, deviceData);
304
304
  // 将需要上报的数据缓存在队列中
305
305
  ReportDataQueue.push(result);
@@ -342,6 +342,7 @@ const sendData = async () => {
342
342
  * @returns {void}
343
343
  */
344
344
  const startSendTimer = (clearTimerAfterSend) => {
345
+ clearInterval(ReportTaskId);
345
346
  ReportTaskId = setInterval(async () => {
346
347
  sendData();
347
348
  if (clearTimerAfterSend) {
@@ -395,15 +396,25 @@ const setAppShowOptions = (options) => {
395
396
  * init之后再监听
396
397
  */
397
398
  const startListenApp = () => {
399
+ const doAppShow = (options) => {
400
+ // 更新onShow参数
401
+ setAppShowOptions(options);
402
+ // 上报数据
403
+ report(true);
404
+ };
405
+
406
+ // 避免vendor分包加载太慢而错过onAppShow
407
+ if (wx.tmsAppShowOptions) {
408
+ doAppShow(wx.tmsAppShowOptions);
409
+ wx.tmsAppShowOptions = null;
410
+ }
411
+
398
412
  /**
399
413
  * 监听小程序onShow事件
400
414
  * @private
401
415
  */
402
416
  wx.onAppShow((options) => {
403
- // 更新onShow参数
404
- setAppShowOptions(options);
405
- // 上报数据
406
- report(true);
417
+ doAppShow(options);
407
418
  });
408
419
 
409
420
  /**