@ray-js/robot-data-stream 0.0.10-beta-1 → 0.0.10-beta-2

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.
@@ -561,11 +561,12 @@ export class SweeperP2p extends P2pApi {
561
561
  stopObserverSweeperDataByP2P = async () => {
562
562
  try {
563
563
  this.removeP2pDownloadEvent();
564
- await this.cancelDownloadTask();
564
+ this.cancelDownloadTask();
565
565
 
566
566
  // 先销毁断开监听
567
567
  typeof this.offSessionStatusChange === 'function' && this.offSessionStatusChange();
568
568
  // 销毁初始化时,先进行断连操作
569
+
569
570
  if (this.isConnected) {
570
571
  this.disconnectDevice();
571
572
  }
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import mitt from 'mitt';
4
4
  import log4js from '@ray-js/log4js';
5
5
  import { SweeperP2pInstance } from './api';
6
6
  import sweeperP2pInstance from './api/sweeperP2p';
7
- import { getSystemInfoSync } from '@ray-js/ray';
7
+ import { getSystemInfoSync, usePageEvent } from '@ray-js/ray';
8
8
  const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
9
9
  const {
10
10
  logTag,
@@ -39,12 +39,12 @@ const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
39
39
  });
40
40
  onEnterBackground();
41
41
  onEnterForeground();
42
- return () => {
43
- unmount();
44
- SweeperP2pInstance.deInitP2PSDK();
45
- timer && clearInterval(timer);
46
- };
47
42
  }, []);
43
+ usePageEvent('onUnload', () => {
44
+ unmount();
45
+ SweeperP2pInstance.deInitP2PSDK();
46
+ timer && clearInterval(timer);
47
+ });
48
48
 
49
49
  /**
50
50
  * p2p连接
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/robot-data-stream",
3
- "version": "0.0.10-beta-1",
3
+ "version": "0.0.10-beta-2",
4
4
  "description": "扫地机P2P数据流标准化组件",
5
5
  "main": "lib/index",
6
6
  "files": [