@ray-js/robot-data-stream 0.0.10-beta-17 → 0.0.10-beta-19

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.
@@ -22,19 +22,16 @@ export function normalResolve(reqType, taskId) {
22
22
  return new Promise((resolve, reject) => {
23
23
  // 设置超时定时器
24
24
  const timer = setTimeout(() => {
25
- reject(new MyError('Request timed out', {
25
+ reject(new MyError(`${taskId} Request timed out `, {
26
26
  errCode: -1,
27
27
  reqType
28
28
  }));
29
- }, 5 * 1000);
30
-
31
- // 监听指定类型的消息
32
- emitter.on(reqType, message => {
29
+ }, 10 * 1000);
30
+ const handle = message => {
33
31
  if (`${message.taskId}` !== `${taskId}`) {
34
32
  return;
35
33
  }
36
34
  clearTimeout(timer);
37
- emitter.off(reqType);
38
35
  if (message.errCode === 0) {
39
36
  resolve(message);
40
37
  } else {
@@ -43,6 +40,10 @@ export function normalResolve(reqType, taskId) {
43
40
  reqType
44
41
  }));
45
42
  }
46
- });
43
+ emitter.off(reqType, handle);
44
+ };
45
+
46
+ // 监听指定类型的消息
47
+ emitter.on(reqType, handle);
47
48
  });
48
49
  }
@@ -50,7 +50,6 @@ export const useSpotClean = devId => {
50
50
  yMops = new Array(num).fill(-1),
51
51
  sweepMopModes = new Array(num).fill('only_sweep')
52
52
  } = message;
53
- const names = new Array(num).fill('');
54
53
  if (suctions && !isArray(suctions)) {
55
54
  return Promise.reject(new Error('suctions is illegal'));
56
55
  }
@@ -66,10 +65,7 @@ export const useSpotClean = devId => {
66
65
  if (sweepMopModes && !isArray(sweepMopModes)) {
67
66
  return Promise.reject(new Error('sweepMopModes is illegal'));
68
67
  }
69
- if (names && !isArray(names)) {
70
- return Promise.reject(new Error('names is illegal'));
71
- }
72
- if (num !== suctions.length || num !== cisterns.length || num !== cleanCounts.length || num !== yMops.length || num !== sweepMopModes.length || num !== names.length) {
68
+ if (num !== suctions.length || num !== cisterns.length || num !== cleanCounts.length || num !== yMops.length || num !== sweepMopModes.length) {
73
69
  return Promise.reject(new Error('The length of the parameters is inconsistent'));
74
70
  }
75
71
  const params = createSetCommonParams({
@@ -82,8 +78,7 @@ export const useSpotClean = devId => {
82
78
  cisterns,
83
79
  cleanCounts,
84
80
  yMops,
85
- sweepMopModes,
86
- names
81
+ sweepMopModes
87
82
  }
88
83
  });
89
84
  ty.device.sendMqttMessage(params);
@@ -82,7 +82,7 @@ export const useZoneClean = devId => {
82
82
  name
83
83
  } = _ref;
84
84
  polygons.push(pointsToString(points, origin));
85
- names.push(name);
85
+ names.push(name || '');
86
86
  });
87
87
  const params = createSetCommonParams({
88
88
  deviceId: devId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/robot-data-stream",
3
- "version": "0.0.10-beta-17",
3
+ "version": "0.0.10-beta-19",
4
4
  "description": "扫地机P2P数据流标准化组件",
5
5
  "main": "lib/index",
6
6
  "files": [