@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.
- package/lib/api/sweeperP2p.js +2 -1
- package/lib/index.js +6 -6
- package/package.json +1 -1
package/lib/api/sweeperP2p.js
CHANGED
|
@@ -561,11 +561,12 @@ export class SweeperP2p extends P2pApi {
|
|
|
561
561
|
stopObserverSweeperDataByP2P = async () => {
|
|
562
562
|
try {
|
|
563
563
|
this.removeP2pDownloadEvent();
|
|
564
|
-
|
|
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连接
|