@ray-js/robot-data-stream 0.0.2 → 0.0.4
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/index.d.ts +3 -1
- package/lib/index.js +8 -1
- package/package.json +4 -6
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
declare const useP2PDataStream: (devId: string, onReceiveMapData: (data: string) => void, onReceivePathData: (data: string) => void
|
|
1
|
+
declare const useP2PDataStream: (devId: string, onReceiveMapData: (data: string) => void, onReceivePathData: (data: string) => void, opt?: {
|
|
2
|
+
logTag?: string | undefined;
|
|
3
|
+
} | undefined) => void;
|
|
2
4
|
declare const StreamDataNotificationCenter: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
|
|
3
5
|
export { useP2PDataStream, StreamDataNotificationCenter };
|
package/lib/index.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
/* eslint-disable consistent-return */
|
|
1
2
|
import { useEffect, useRef } from 'react';
|
|
2
3
|
import mitt from 'mitt';
|
|
3
4
|
import { SweeperP2pInstance } from './api';
|
|
4
5
|
import log4js from '@ray-js/log4js';
|
|
5
|
-
const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData) => {
|
|
6
|
+
const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
|
|
7
|
+
const {
|
|
8
|
+
logTag
|
|
9
|
+
} = opt || {};
|
|
6
10
|
const isInit = useRef(null);
|
|
7
11
|
const offSessionStatusChange = useRef(null);
|
|
8
12
|
const isAppOnBackground = useRef(false);
|
|
9
13
|
const timer = useRef(null);
|
|
10
14
|
useEffect(() => {
|
|
15
|
+
if (logTag) {
|
|
16
|
+
log4js.setTag(logTag);
|
|
17
|
+
}
|
|
11
18
|
if (devId.startsWith('vdevo')) {
|
|
12
19
|
log4js.warn('virtual device cannot use p2p');
|
|
13
20
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/robot-data-stream",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "扫地机P2P数据流标准化组件",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"release-it": "standard-version"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@ray-js/ray": "^1.5.0"
|
|
34
|
+
"@ray-js/ray": "^1.5.0",
|
|
35
|
+
"@ray-js/log4js": "^0.0.4"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@ray-js/log4js": "^0.0.2",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"lodash-es": "^4.17.21",
|
|
40
40
|
"mitt": "^3.0.1",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@commitlint/cli": "^7.2.1",
|
|
45
45
|
"@commitlint/config-conventional": "^9.0.1",
|
|
46
46
|
"@ray-js/cli": "^1.5.20",
|
|
47
|
+
"@ray-js/log4js": "^0.0.4",
|
|
47
48
|
"@ray-js/ray": "^1.5.0",
|
|
48
49
|
"core-js": "^3.19.1",
|
|
49
50
|
"eslint-config-tuya-panel": "^0.4.2",
|
|
@@ -52,9 +53,6 @@
|
|
|
52
53
|
"patch-package": "^8.0.0",
|
|
53
54
|
"standard-version": "9.3.2"
|
|
54
55
|
},
|
|
55
|
-
"resolutions": {
|
|
56
|
-
"@ray-js/builder-mp": "1.4.15"
|
|
57
|
-
},
|
|
58
56
|
"husky": {
|
|
59
57
|
"hooks": {
|
|
60
58
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js",
|