@robotical/webapp-types 3.7.34 → 3.7.35
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/dist-types/src/application/ApplicationManager/ApplicationManager.js +1 -3
- package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.js +2 -2
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +36 -26
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +63 -0
- package/package.json +1 -1
|
@@ -668,9 +668,9 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
668
668
|
}
|
|
669
669
|
window.applicationManager.stopDiscovery();
|
|
670
670
|
secondaryModalState.closeModal();
|
|
671
|
+
raftFoundSubscriptionHelper().unsubscribe();
|
|
671
672
|
clearTimeout(notFoundTimeout);
|
|
672
673
|
}, 7000);
|
|
673
|
-
Logger.phoneAppLog(SHOW_LOGS, TAG, "before raftFoundSubscriptionHelper");
|
|
674
674
|
raftFoundSubscriptionHelper().subscribe(function (_a) {
|
|
675
675
|
var discoveredDevice = _a.discoveredDevice;
|
|
676
676
|
return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -714,7 +714,6 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
714
714
|
if (!wasDiscoveryStarted) {
|
|
715
715
|
return [2 /*return*/, raftFoundSubscriptionHelper().unsubscribe()];
|
|
716
716
|
}
|
|
717
|
-
raftFoundSubscriptionHelper().unsubscribe();
|
|
718
717
|
return [2 /*return*/];
|
|
719
718
|
}
|
|
720
719
|
});
|
|
@@ -732,7 +731,6 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
732
731
|
case 0: return [4 /*yield*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_STOP_DISCOVERY)];
|
|
733
732
|
case 1:
|
|
734
733
|
wasDiscoveryStopped = _a.sent();
|
|
735
|
-
Logger.phoneAppLog(SHOW_LOGS, TAG, "Was discovery stopped: " + wasDiscoveryStopped);
|
|
736
734
|
return [2 /*return*/];
|
|
737
735
|
}
|
|
738
736
|
});
|
|
@@ -49,7 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
import {
|
|
52
|
+
import { createRaftPubSubscriptionHelper } from "../raft-subscription-helpers";
|
|
53
53
|
import { isVersionGreater_errorCatching } from "../../../utils/helpers/compare-version";
|
|
54
54
|
import EventEmitter from "events";
|
|
55
55
|
import Logger from "../../../services/logger/Logger";
|
|
@@ -117,7 +117,7 @@ var PublishedDataAnalyser = /** @class */ (function (_super) {
|
|
|
117
117
|
}
|
|
118
118
|
PublishedDataAnalyser.prototype.subscribeToPublishedData = function () {
|
|
119
119
|
var _this = this;
|
|
120
|
-
this.pubSub =
|
|
120
|
+
this.pubSub = createRaftPubSubscriptionHelper(this.cog);
|
|
121
121
|
this.pubSub.subscribe(function (data) {
|
|
122
122
|
_this.analyse(data.stateInfo);
|
|
123
123
|
});
|
|
@@ -1,63 +1,73 @@
|
|
|
1
1
|
import RAFT from "./RAFT";
|
|
2
|
-
/**
|
|
3
|
-
* Connection Verifying Subscription Helper
|
|
4
|
-
*/
|
|
5
2
|
export declare const raftConnectingSubscriptionHelper: (raft: RAFT) => {
|
|
6
3
|
subscribe: (callback: any) => void;
|
|
7
4
|
unsubscribe: () => void;
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export declare const createRaftConnectingHelper: (raft: RAFT) => {
|
|
7
|
+
subscribe: (callback: any) => void;
|
|
8
|
+
unsubscribe: () => void;
|
|
9
|
+
};
|
|
12
10
|
export declare const raftConnectedSubscriptionHelper: (raft: RAFT) => {
|
|
13
11
|
subscribe: (callback: any) => void;
|
|
14
12
|
unsubscribe: () => void;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export declare const createRaftConnectedHelper: (raft: RAFT) => {
|
|
15
|
+
subscribe: (callback: any) => void;
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
};
|
|
19
18
|
export declare const raftDisconnectedSubscriptionHelper: (raft: RAFT) => {
|
|
20
19
|
subscribe: (callback: any) => void;
|
|
21
20
|
unsubscribe: () => void;
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export declare const createRaftDisconnectedHelper: (raft: RAFT) => {
|
|
23
|
+
subscribe: (callback: any) => void;
|
|
24
|
+
unsubscribe: () => void;
|
|
25
|
+
};
|
|
26
26
|
export declare const raftVerifiedSubscriptionHelper: (raft: RAFT) => {
|
|
27
27
|
subscribe: (callback: any) => void;
|
|
28
28
|
unsubscribe: () => void;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
export declare const createRaftVerifiedHelper: (raft: RAFT) => {
|
|
31
|
+
subscribe: (callback: any) => void;
|
|
32
|
+
unsubscribe: () => void;
|
|
33
|
+
};
|
|
34
34
|
export declare const raftFoundSubscriptionHelper: () => {
|
|
35
35
|
subscribe: (callback: any) => void;
|
|
36
36
|
unsubscribe: () => void;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export declare const createRaftFoundHelper: () => {
|
|
39
|
+
subscribe: (callback: any) => void;
|
|
40
|
+
unsubscribe: () => void;
|
|
41
|
+
};
|
|
41
42
|
export declare const raftDiscoveryFinishedSubscriptionHelper: () => {
|
|
42
43
|
subscribe: (callback: any) => void;
|
|
43
44
|
unsubscribe: () => void;
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
export declare const createRaftDiscoveryFinishedHelper: () => {
|
|
47
|
+
subscribe: (callback: any) => void;
|
|
48
|
+
unsubscribe: () => void;
|
|
49
|
+
};
|
|
48
50
|
export declare const raftDiscoveryStartedSubscriptionHelper: () => {
|
|
49
51
|
subscribe: (callback: any) => void;
|
|
50
52
|
unsubscribe: () => void;
|
|
51
53
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
export declare const createRaftDiscoveryStartedHelper: () => {
|
|
55
|
+
subscribe: (callback: any) => void;
|
|
56
|
+
unsubscribe: () => void;
|
|
57
|
+
};
|
|
56
58
|
export declare const raftRejectedSubscriptionHelper: (raft: RAFT) => {
|
|
57
59
|
subscribe: (callback: any) => void;
|
|
58
60
|
unsubscribe: () => void;
|
|
59
61
|
};
|
|
62
|
+
export declare const createRaftRejectedHelper: (raft: RAFT) => {
|
|
63
|
+
subscribe: (callback: any) => void;
|
|
64
|
+
unsubscribe: () => void;
|
|
65
|
+
};
|
|
60
66
|
export declare const raftPubSubscriptionHelper: (raft: RAFT) => {
|
|
61
67
|
subscribe: (callback: (eventData: any) => void) => void;
|
|
62
68
|
unsubscribe: () => void;
|
|
63
69
|
};
|
|
70
|
+
export declare const createRaftPubSubscriptionHelper: (raft: RAFT) => {
|
|
71
|
+
subscribe: (callback: (eventData: any) => void) => void;
|
|
72
|
+
unsubscribe: () => void;
|
|
73
|
+
};
|
|
@@ -2,7 +2,14 @@ import { RaftConnEvent } from "@robotical/raftjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* Connection Verifying Subscription Helper
|
|
4
4
|
*/
|
|
5
|
+
var raftConnectingHelperInstance = null;
|
|
5
6
|
export var raftConnectingSubscriptionHelper = function (raft) {
|
|
7
|
+
if (!raftConnectingHelperInstance) {
|
|
8
|
+
raftConnectingHelperInstance = createRaftConnectingHelper(raft);
|
|
9
|
+
}
|
|
10
|
+
return raftConnectingHelperInstance;
|
|
11
|
+
};
|
|
12
|
+
export var createRaftConnectingHelper = function (raft) {
|
|
6
13
|
var observer = null;
|
|
7
14
|
return {
|
|
8
15
|
subscribe: function (callback) {
|
|
@@ -45,7 +52,14 @@ var raftConnectingSubscriptionObserver_ = function (callback) {
|
|
|
45
52
|
/**
|
|
46
53
|
* RAFT Connected Subscription Helper
|
|
47
54
|
*/
|
|
55
|
+
var raftConnectedHelperInstance = null;
|
|
48
56
|
export var raftConnectedSubscriptionHelper = function (raft) {
|
|
57
|
+
if (!raftConnectedHelperInstance) {
|
|
58
|
+
raftConnectedHelperInstance = createRaftConnectedHelper(raft);
|
|
59
|
+
}
|
|
60
|
+
return raftConnectedHelperInstance;
|
|
61
|
+
};
|
|
62
|
+
export var createRaftConnectedHelper = function (raft) {
|
|
49
63
|
var observer = null;
|
|
50
64
|
return {
|
|
51
65
|
subscribe: function (callback) {
|
|
@@ -90,7 +104,14 @@ var raftConnectedSubscriptionObserver_ = function (callback) {
|
|
|
90
104
|
/**
|
|
91
105
|
* RAFT Disconnected Subscription Helper
|
|
92
106
|
*/
|
|
107
|
+
var raftDisconnectedHelperInstance = null;
|
|
93
108
|
export var raftDisconnectedSubscriptionHelper = function (raft) {
|
|
109
|
+
if (!raftDisconnectedHelperInstance) {
|
|
110
|
+
raftDisconnectedHelperInstance = createRaftDisconnectedHelper(raft);
|
|
111
|
+
}
|
|
112
|
+
return raftDisconnectedHelperInstance;
|
|
113
|
+
};
|
|
114
|
+
export var createRaftDisconnectedHelper = function (raft) {
|
|
94
115
|
var observer = null;
|
|
95
116
|
return {
|
|
96
117
|
subscribe: function (callback) {
|
|
@@ -135,7 +156,14 @@ var raftDisconnectedSubscriptionObserver_ = function (callback) {
|
|
|
135
156
|
/**
|
|
136
157
|
* RAFT Verified Subscription Helper
|
|
137
158
|
*/
|
|
159
|
+
var raftVerifiedHelperInstance = null;
|
|
138
160
|
export var raftVerifiedSubscriptionHelper = function (raft) {
|
|
161
|
+
if (!raftVerifiedHelperInstance) {
|
|
162
|
+
raftVerifiedHelperInstance = createRaftVerifiedHelper(raft);
|
|
163
|
+
}
|
|
164
|
+
return raftVerifiedHelperInstance;
|
|
165
|
+
};
|
|
166
|
+
export var createRaftVerifiedHelper = function (raft) {
|
|
139
167
|
var observer = null;
|
|
140
168
|
return {
|
|
141
169
|
subscribe: function (callback) {
|
|
@@ -179,7 +207,14 @@ var raftVerifiedSubscriptionObserver_ = function (callback) {
|
|
|
179
207
|
* Subscription Helper for raftFound event
|
|
180
208
|
* ApplicationManager
|
|
181
209
|
*/
|
|
210
|
+
var raftFoundHelperInstance = null;
|
|
182
211
|
export var raftFoundSubscriptionHelper = function () {
|
|
212
|
+
if (!raftFoundHelperInstance) {
|
|
213
|
+
raftFoundHelperInstance = createRaftFoundHelper();
|
|
214
|
+
}
|
|
215
|
+
return raftFoundHelperInstance;
|
|
216
|
+
};
|
|
217
|
+
export var createRaftFoundHelper = function () {
|
|
183
218
|
var observer = null;
|
|
184
219
|
return {
|
|
185
220
|
subscribe: function (callback) {
|
|
@@ -213,7 +248,14 @@ var raftFoundSubscriptionObserver_ = function (callback) {
|
|
|
213
248
|
/**
|
|
214
249
|
* Subscription Helper for raftDiscoveryFinished event
|
|
215
250
|
*/
|
|
251
|
+
var raftDiscoveryFinishedHelperInstance = null;
|
|
216
252
|
export var raftDiscoveryFinishedSubscriptionHelper = function () {
|
|
253
|
+
if (!raftDiscoveryFinishedHelperInstance) {
|
|
254
|
+
raftDiscoveryFinishedHelperInstance = createRaftDiscoveryFinishedHelper();
|
|
255
|
+
}
|
|
256
|
+
return raftDiscoveryFinishedHelperInstance;
|
|
257
|
+
};
|
|
258
|
+
export var createRaftDiscoveryFinishedHelper = function () {
|
|
217
259
|
var observer = null;
|
|
218
260
|
return {
|
|
219
261
|
subscribe: function (callback) {
|
|
@@ -247,7 +289,14 @@ var raftDiscoveryFinishedSubscriptionObserver_ = function (callback) {
|
|
|
247
289
|
/**
|
|
248
290
|
* Subscription Helper for raftDiscoveryStarted event
|
|
249
291
|
*/
|
|
292
|
+
var raftDiscoveryStartedHelperInstance = null;
|
|
250
293
|
export var raftDiscoveryStartedSubscriptionHelper = function () {
|
|
294
|
+
if (!raftDiscoveryStartedHelperInstance) {
|
|
295
|
+
raftDiscoveryStartedHelperInstance = createRaftDiscoveryStartedHelper();
|
|
296
|
+
}
|
|
297
|
+
return raftDiscoveryStartedHelperInstance;
|
|
298
|
+
};
|
|
299
|
+
export var createRaftDiscoveryStartedHelper = function () {
|
|
251
300
|
var observer = null;
|
|
252
301
|
return {
|
|
253
302
|
subscribe: function (callback) {
|
|
@@ -282,7 +331,14 @@ var raftDiscoveryStartedSubscriptionObserver_ = function (callback) {
|
|
|
282
331
|
* Subscription Helper for raftRejected event
|
|
283
332
|
* This event is triggered when the RAFT is rejected during the verification process
|
|
284
333
|
*/
|
|
334
|
+
var raftRejectedHelperInstance = null;
|
|
285
335
|
export var raftRejectedSubscriptionHelper = function (raft) {
|
|
336
|
+
if (!raftRejectedHelperInstance) {
|
|
337
|
+
raftRejectedHelperInstance = createRaftRejectedHelper(raft);
|
|
338
|
+
}
|
|
339
|
+
return raftRejectedHelperInstance;
|
|
340
|
+
};
|
|
341
|
+
export var createRaftRejectedHelper = function (raft) {
|
|
286
342
|
var observer = null;
|
|
287
343
|
return {
|
|
288
344
|
subscribe: function (callback) {
|
|
@@ -322,7 +378,14 @@ var raftRejectedSubscriptionObserver_ = function (callback) {
|
|
|
322
378
|
},
|
|
323
379
|
};
|
|
324
380
|
};
|
|
381
|
+
var raftPubSubscriptionHelperInstance = null;
|
|
325
382
|
export var raftPubSubscriptionHelper = function (raft) {
|
|
383
|
+
if (!raftPubSubscriptionHelperInstance) {
|
|
384
|
+
raftPubSubscriptionHelperInstance = createRaftPubSubscriptionHelper(raft);
|
|
385
|
+
}
|
|
386
|
+
return raftPubSubscriptionHelperInstance;
|
|
387
|
+
};
|
|
388
|
+
export var createRaftPubSubscriptionHelper = function (raft) {
|
|
326
389
|
var observer = null;
|
|
327
390
|
return {
|
|
328
391
|
subscribe: function (callback) {
|