flinker 2.0.0 → 2.0.1
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/RX.d.ts +2 -2
- package/dist/RXOperator.d.ts +3 -3
- package/dist/RXPipeline.d.ts +3 -3
- package/dist/RXPublisher.d.ts +1 -1
- package/dist/RXSubscriber.d.ts +2 -2
- package/dist/esm/RX.js +19 -27
- package/dist/esm/RXOperator.js +232 -316
- package/dist/esm/RXPipeline.js +11 -17
- package/dist/esm/RXPublisher.js +319 -471
- package/dist/esm/RXSubscriber.js +25 -35
- package/dist/esm/Utils.js +50 -93
- package/dist/esm/index.js +6 -6
- package/dist/index.d.ts +6 -6
- package/package.json +3 -3
- package/dist/cjs/RX.js +0 -41
- package/dist/cjs/RXOperator.js +0 -484
- package/dist/cjs/RXPipeline.js +0 -27
- package/dist/cjs/RXPublisher.js +0 -725
- package/dist/cjs/RXSubscriber.js +0 -77
- package/dist/cjs/Utils.js +0 -257
- package/dist/cjs/index.js +0 -43
package/dist/esm/RXPublisher.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
1
|
import { RXPipeline } from './RXPipeline';
|
|
17
2
|
//WeakRef is not supported in RN
|
|
18
3
|
// export class RXPipelineGarbage {
|
|
@@ -31,14 +16,14 @@ import { RXPipeline } from './RXPipeline';
|
|
|
31
16
|
// Logger.i('GC: disposed pipelines:', disposedCount + '/' + this.total)
|
|
32
17
|
// }
|
|
33
18
|
// }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return
|
|
19
|
+
const generateSUID = (() => {
|
|
20
|
+
let value = 0;
|
|
21
|
+
return () => {
|
|
37
22
|
return value++;
|
|
38
23
|
};
|
|
39
24
|
})();
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
export class RXPublisher {
|
|
26
|
+
constructor() {
|
|
42
27
|
this.suid = generateSUID();
|
|
43
28
|
this.type = 'observable';
|
|
44
29
|
this._isComplete = false;
|
|
@@ -49,287 +34,230 @@ var RXPublisher = /** @class */ (function () {
|
|
|
49
34
|
this.isSending = false;
|
|
50
35
|
this.pipelines = Array();
|
|
51
36
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Object.defineProperty(RXPublisher.prototype, "asObservable", {
|
|
58
|
-
get: function () { return this; },
|
|
59
|
-
enumerable: false,
|
|
60
|
-
configurable: true
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(RXPublisher.prototype, "isComplete", {
|
|
63
|
-
get: function () { return this._isComplete; },
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
RXPublisher.prototype.pipe = function () {
|
|
68
|
-
var pipe = new RXPipeline(this);
|
|
37
|
+
get volume() { return this.pipelines.length; }
|
|
38
|
+
get asObservable() { return this; }
|
|
39
|
+
get isComplete() { return this._isComplete; }
|
|
40
|
+
pipe() {
|
|
41
|
+
const pipe = new RXPipeline(this);
|
|
69
42
|
this.pipelines.push(pipe);
|
|
70
43
|
//RXPipelineGarbage.self.register(pipe)
|
|
71
44
|
return pipe.asOperator;
|
|
72
|
-
}
|
|
73
|
-
|
|
45
|
+
}
|
|
46
|
+
didSubscribe(p) {
|
|
74
47
|
this.isComplete && p.sendComplete(false);
|
|
75
|
-
}
|
|
76
|
-
|
|
48
|
+
}
|
|
49
|
+
didUnsubscribe(p) {
|
|
77
50
|
if (this.isSending) {
|
|
78
51
|
this.pendingUnsubscribePipes.push(p);
|
|
79
52
|
return;
|
|
80
53
|
}
|
|
81
|
-
|
|
54
|
+
const index = this.pipelines.indexOf(p);
|
|
82
55
|
index !== -1 && this.pipelines.splice(index, 1);
|
|
83
|
-
}
|
|
84
|
-
|
|
56
|
+
}
|
|
57
|
+
send(value) {
|
|
85
58
|
this.isSending = true;
|
|
86
|
-
this.pipelines.forEach(
|
|
59
|
+
this.pipelines.forEach(i => { i.send(value, true); });
|
|
87
60
|
this.isSending = false;
|
|
88
61
|
this.runPendingOperations();
|
|
89
|
-
}
|
|
90
|
-
|
|
62
|
+
}
|
|
63
|
+
sendError(e) {
|
|
91
64
|
this.isSending = true;
|
|
92
|
-
this.pipelines.forEach(
|
|
65
|
+
this.pipelines.forEach(i => { i.sendError(e, true); });
|
|
93
66
|
this.isSending = false;
|
|
94
67
|
this.runPendingOperations();
|
|
95
|
-
}
|
|
96
|
-
|
|
68
|
+
}
|
|
69
|
+
sendComplete() {
|
|
97
70
|
this.isSending = true;
|
|
98
71
|
this._isComplete = true;
|
|
99
|
-
this.pipelines.forEach(
|
|
72
|
+
this.pipelines.forEach(i => { i.sendComplete(true); });
|
|
100
73
|
this.pipelines.length = 0;
|
|
101
74
|
this.isSending = false;
|
|
102
75
|
this.runPendingOperations();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var _this = this;
|
|
76
|
+
}
|
|
77
|
+
runPendingOperations() {
|
|
106
78
|
if (this.isSending)
|
|
107
79
|
return;
|
|
108
80
|
if (this.pendingUnsubscribePipes.length > 0) {
|
|
109
|
-
this.pendingUnsubscribePipes.forEach(
|
|
81
|
+
this.pendingUnsubscribePipes.forEach(p => { this.didUnsubscribe(p); });
|
|
110
82
|
this.pendingUnsubscribePipes.length = 0;
|
|
111
83
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
}());
|
|
115
|
-
export { RXPublisher };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
116
86
|
//--------------------------------------
|
|
117
87
|
// RXJustComplete
|
|
118
88
|
//--------------------------------------
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
RXJustComplete.prototype.didSubscribe = function (p) {
|
|
89
|
+
export class RXJustComplete extends RXPublisher {
|
|
90
|
+
constructor(value) {
|
|
91
|
+
super();
|
|
92
|
+
this.value = value;
|
|
93
|
+
value !== undefined && this.send(value);
|
|
94
|
+
this.sendComplete();
|
|
95
|
+
}
|
|
96
|
+
didSubscribe(p) {
|
|
129
97
|
this.isComplete && this.value !== undefined && p.send(this.value, false);
|
|
130
98
|
this.isComplete && p.sendComplete(false);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}(RXPublisher));
|
|
134
|
-
export { RXJustComplete };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
135
101
|
//--------------------------------------
|
|
136
102
|
// RXJustError
|
|
137
103
|
//--------------------------------------
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
RXJustError.prototype.didSubscribe = function (p) {
|
|
104
|
+
export class RXJustError extends RXPublisher {
|
|
105
|
+
constructor(error) {
|
|
106
|
+
super();
|
|
107
|
+
this.error = error;
|
|
108
|
+
this.sendError(error);
|
|
109
|
+
this.sendComplete();
|
|
110
|
+
}
|
|
111
|
+
didSubscribe(p) {
|
|
148
112
|
this.isComplete && p.sendError(this.error, false);
|
|
149
113
|
this.isComplete && p.sendComplete(false);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}(RXPublisher));
|
|
153
|
-
export { RXJustError };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
154
116
|
//--------------------------------------
|
|
155
117
|
// RXDelayedComplete
|
|
156
118
|
//--------------------------------------
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
_this.sendComplete();
|
|
119
|
+
export class RXDelayedComplete extends RXPublisher {
|
|
120
|
+
constructor(ms, value) {
|
|
121
|
+
super();
|
|
122
|
+
this.value = value;
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
value !== undefined && this.send(value);
|
|
125
|
+
this.sendComplete();
|
|
165
126
|
}, ms);
|
|
166
|
-
return _this;
|
|
167
127
|
}
|
|
168
|
-
|
|
128
|
+
didSubscribe(p) {
|
|
169
129
|
this.isComplete && this.value !== undefined && p.send(this.value, false);
|
|
170
130
|
this.isComplete && p.sendComplete(false);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}(RXPublisher));
|
|
174
|
-
export { RXDelayedComplete };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
175
133
|
//--------------------------------------
|
|
176
134
|
// RXDelayedError
|
|
177
135
|
//--------------------------------------
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
_this.sendComplete();
|
|
136
|
+
export class RXDelayedError extends RXPublisher {
|
|
137
|
+
constructor(ms, error) {
|
|
138
|
+
super();
|
|
139
|
+
this.error = error;
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
this.sendError(error);
|
|
142
|
+
this.sendComplete();
|
|
186
143
|
}, ms);
|
|
187
|
-
return _this;
|
|
188
144
|
}
|
|
189
|
-
|
|
145
|
+
didSubscribe(p) {
|
|
190
146
|
this.isComplete && p.sendError(this.error, false);
|
|
191
147
|
this.isComplete && p.sendComplete(false);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}(RXPublisher));
|
|
195
|
-
export { RXDelayedError };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
196
150
|
//--------------------------------------
|
|
197
151
|
// RXEmitter
|
|
198
152
|
//--------------------------------------
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
get: function () { return this._value; },
|
|
210
|
-
enumerable: false,
|
|
211
|
-
configurable: true
|
|
212
|
-
});
|
|
213
|
-
Object.defineProperty(RXEmitter.prototype, "err", {
|
|
214
|
-
get: function () { return this._err; },
|
|
215
|
-
enumerable: false,
|
|
216
|
-
configurable: true
|
|
217
|
-
});
|
|
218
|
-
RXEmitter.prototype.send = function (value) {
|
|
153
|
+
export class RXEmitter extends RXPublisher {
|
|
154
|
+
get value() { return this._value; }
|
|
155
|
+
get err() { return this._err; }
|
|
156
|
+
constructor() {
|
|
157
|
+
super();
|
|
158
|
+
this._hasValue = false;
|
|
159
|
+
this.hasError = false;
|
|
160
|
+
this._err = undefined;
|
|
161
|
+
}
|
|
162
|
+
send(value) {
|
|
219
163
|
if (this.isComplete)
|
|
220
164
|
return;
|
|
221
165
|
this._value = value;
|
|
222
166
|
this._hasValue = true;
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
167
|
+
super.send(value);
|
|
168
|
+
}
|
|
169
|
+
sendError(e) {
|
|
226
170
|
if (this.isComplete)
|
|
227
171
|
return;
|
|
228
172
|
this._err = e;
|
|
229
173
|
this.hasError = true;
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
174
|
+
super.sendError(e);
|
|
175
|
+
}
|
|
176
|
+
sendComplete() {
|
|
233
177
|
if (this.isComplete)
|
|
234
178
|
return;
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
179
|
+
super.sendComplete();
|
|
180
|
+
}
|
|
181
|
+
didSubscribe(p) {
|
|
238
182
|
this.hasError && p.sendError(this.err, false);
|
|
239
183
|
!this.hasError && this._hasValue && p.send(this.value, false);
|
|
240
184
|
this.isComplete && p.sendComplete(false);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
}(RXPublisher));
|
|
244
|
-
export { RXEmitter };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
245
187
|
//--------------------------------------
|
|
246
188
|
// RXSubject
|
|
247
189
|
//--------------------------------------
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
configurable: true
|
|
261
|
-
});
|
|
262
|
-
Object.defineProperty(RXSubject.prototype, "err", {
|
|
263
|
-
get: function () {
|
|
264
|
-
return this._err;
|
|
265
|
-
},
|
|
266
|
-
enumerable: false,
|
|
267
|
-
configurable: true
|
|
268
|
-
});
|
|
269
|
-
RXSubject.prototype.send = function (value) {
|
|
190
|
+
export class RXSubject extends RXPublisher {
|
|
191
|
+
get value() { return this._value; }
|
|
192
|
+
get err() {
|
|
193
|
+
return this._err;
|
|
194
|
+
}
|
|
195
|
+
constructor(value) {
|
|
196
|
+
super();
|
|
197
|
+
this._hasError = false;
|
|
198
|
+
this._err = undefined;
|
|
199
|
+
this._value = value;
|
|
200
|
+
}
|
|
201
|
+
send(value) {
|
|
270
202
|
if (this.isComplete)
|
|
271
203
|
return;
|
|
272
204
|
this._value = value;
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
205
|
+
super.send(value);
|
|
206
|
+
}
|
|
207
|
+
resend() {
|
|
208
|
+
super.send(this.value);
|
|
209
|
+
}
|
|
210
|
+
sendError(e) {
|
|
279
211
|
if (this.isComplete)
|
|
280
212
|
return;
|
|
281
213
|
this._err = e;
|
|
282
214
|
this._hasError = true;
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
215
|
+
super.sendError(e);
|
|
216
|
+
}
|
|
217
|
+
sendComplete() {
|
|
286
218
|
if (this.isComplete)
|
|
287
219
|
return;
|
|
288
220
|
this._isComplete = true;
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
221
|
+
super.sendComplete();
|
|
222
|
+
}
|
|
223
|
+
didSubscribe(p) {
|
|
292
224
|
this._hasError && p.sendError(this.err, false);
|
|
293
225
|
!this._hasError && p.send(this.value, false);
|
|
294
226
|
this.isComplete && p.sendComplete(false);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
}(RXPublisher));
|
|
298
|
-
export { RXSubject };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
299
229
|
//--------------------------------------
|
|
300
230
|
// RXBuffer
|
|
301
231
|
//--------------------------------------
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
RXBuffer.prototype.send = function (value) {
|
|
232
|
+
export class RXBuffer extends RXPublisher {
|
|
233
|
+
constructor() {
|
|
234
|
+
super(...arguments);
|
|
235
|
+
this.values = Array();
|
|
236
|
+
this.errors = Array();
|
|
237
|
+
this.isError = Array();
|
|
238
|
+
}
|
|
239
|
+
send(value) {
|
|
312
240
|
if (this.isComplete)
|
|
313
241
|
return;
|
|
314
242
|
this.values.push(value);
|
|
315
243
|
this.isError.push(false);
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
|
|
244
|
+
super.send(value);
|
|
245
|
+
}
|
|
246
|
+
sendError(e) {
|
|
319
247
|
if (this.isComplete)
|
|
320
248
|
return;
|
|
321
249
|
this.errors.push(e);
|
|
322
250
|
this.isError.push(true);
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
251
|
+
super.sendError(e);
|
|
252
|
+
}
|
|
253
|
+
sendComplete() {
|
|
326
254
|
if (this.isComplete)
|
|
327
255
|
return;
|
|
328
256
|
this._isComplete = true;
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
for (
|
|
257
|
+
super.sendComplete();
|
|
258
|
+
}
|
|
259
|
+
didSubscribe(p) {
|
|
260
|
+
for (let i = 0, v = 0, e = 0; i < this.isError.length; i++) {
|
|
333
261
|
if (this.isError[i]) {
|
|
334
262
|
e < this.errors.length && p.sendError(this.errors[e], false);
|
|
335
263
|
e++;
|
|
@@ -340,48 +268,36 @@ var RXBuffer = /** @class */ (function (_super) {
|
|
|
340
268
|
}
|
|
341
269
|
}
|
|
342
270
|
this.isComplete && p.sendComplete(false);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
}(RXPublisher));
|
|
346
|
-
export { RXBuffer };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
347
273
|
//--------------------------------------
|
|
348
274
|
// RXOperation
|
|
349
275
|
//--------------------------------------
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
get: function () { return this._value; },
|
|
361
|
-
enumerable: false,
|
|
362
|
-
configurable: true
|
|
363
|
-
});
|
|
364
|
-
Object.defineProperty(RXOperation.prototype, "err", {
|
|
365
|
-
get: function () { return this._err; },
|
|
366
|
-
enumerable: false,
|
|
367
|
-
configurable: true
|
|
368
|
-
});
|
|
369
|
-
RXOperation.prototype.success = function (value) {
|
|
276
|
+
export class RXOperation extends RXPublisher {
|
|
277
|
+
constructor() {
|
|
278
|
+
super(...arguments);
|
|
279
|
+
this._value = undefined;
|
|
280
|
+
this._hasError = false;
|
|
281
|
+
this._err = undefined;
|
|
282
|
+
}
|
|
283
|
+
get value() { return this._value; }
|
|
284
|
+
get err() { return this._err; }
|
|
285
|
+
success(value) {
|
|
370
286
|
if (this.isComplete)
|
|
371
287
|
return;
|
|
372
288
|
this._value = value;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
289
|
+
super.send(value);
|
|
290
|
+
super.sendComplete();
|
|
291
|
+
}
|
|
292
|
+
fail(e) {
|
|
377
293
|
if (this.isComplete)
|
|
378
294
|
return;
|
|
379
295
|
this._err = e;
|
|
380
296
|
this._hasError = true;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
297
|
+
super.sendError(e);
|
|
298
|
+
super.sendComplete();
|
|
299
|
+
}
|
|
300
|
+
didSubscribe(p) {
|
|
385
301
|
if (!this.isComplete)
|
|
386
302
|
return;
|
|
387
303
|
if (this._hasError) {
|
|
@@ -392,173 +308,139 @@ var RXOperation = /** @class */ (function (_super) {
|
|
|
392
308
|
p.send(this.value, false);
|
|
393
309
|
p.sendComplete(false);
|
|
394
310
|
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
}(RXPublisher));
|
|
398
|
-
export { RXOperation };
|
|
311
|
+
}
|
|
312
|
+
}
|
|
399
313
|
//--------------------------------------
|
|
400
314
|
// RXCombine
|
|
401
315
|
//--------------------------------------
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
op.
|
|
414
|
-
|
|
415
|
-
|
|
316
|
+
export class RXCombine extends RXPublisher {
|
|
317
|
+
get values() { return this._values; }
|
|
318
|
+
get err() { return this._err; }
|
|
319
|
+
constructor(list) {
|
|
320
|
+
super();
|
|
321
|
+
this._values = [];
|
|
322
|
+
this._hasError = false;
|
|
323
|
+
this._err = undefined;
|
|
324
|
+
let count = list.length;
|
|
325
|
+
this._values = new Array(list.length).fill(undefined);
|
|
326
|
+
list.forEach((rx, ind) => {
|
|
327
|
+
const op = rx instanceof RXPublisher ? rx.asObservable.pipe() : rx;
|
|
328
|
+
op.onReceive(v => {
|
|
329
|
+
this.values[ind] = v;
|
|
330
|
+
super.send(this.values);
|
|
416
331
|
})
|
|
417
|
-
.onError(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
332
|
+
.onError((e) => {
|
|
333
|
+
this._err = e;
|
|
334
|
+
this._hasError = true;
|
|
335
|
+
super.sendError(e);
|
|
421
336
|
})
|
|
422
|
-
.onComplete(
|
|
337
|
+
.onComplete(() => {
|
|
423
338
|
count--;
|
|
424
339
|
if (count === 0) {
|
|
425
|
-
|
|
426
|
-
|
|
340
|
+
this._isComplete = true;
|
|
341
|
+
super.sendComplete();
|
|
427
342
|
}
|
|
428
343
|
})
|
|
429
344
|
.subscribe();
|
|
430
345
|
});
|
|
431
346
|
if (count === 0) {
|
|
432
|
-
|
|
347
|
+
super.sendComplete();
|
|
433
348
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
Object.defineProperty(RXCombine.prototype, "values", {
|
|
437
|
-
get: function () { return this._values; },
|
|
438
|
-
enumerable: false,
|
|
439
|
-
configurable: true
|
|
440
|
-
});
|
|
441
|
-
Object.defineProperty(RXCombine.prototype, "err", {
|
|
442
|
-
get: function () { return this._err; },
|
|
443
|
-
enumerable: false,
|
|
444
|
-
configurable: true
|
|
445
|
-
});
|
|
446
|
-
RXCombine.prototype.didSubscribe = function (p) {
|
|
349
|
+
}
|
|
350
|
+
didSubscribe(p) {
|
|
447
351
|
!this._hasError && p.send(this.values, false);
|
|
448
352
|
this._hasError && p.sendError(this.err, false);
|
|
449
353
|
this.isComplete && p.sendComplete(false);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
}(RXPublisher));
|
|
453
|
-
export { RXCombine };
|
|
354
|
+
}
|
|
355
|
+
}
|
|
454
356
|
//--------------------------------------
|
|
455
357
|
// RXFrom
|
|
456
358
|
//--------------------------------------
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
RXFrom.prototype.didSubscribe = function (p) {
|
|
466
|
-
this.values.forEach(function (v) { p.send(v, false); });
|
|
359
|
+
export class RXFrom extends RXPublisher {
|
|
360
|
+
constructor(list) {
|
|
361
|
+
super();
|
|
362
|
+
this.values = list;
|
|
363
|
+
this.sendComplete();
|
|
364
|
+
}
|
|
365
|
+
didSubscribe(p) {
|
|
366
|
+
this.values.forEach(v => { p.send(v, false); });
|
|
467
367
|
p.sendComplete(false);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
}(RXPublisher));
|
|
471
|
-
export { RXFrom };
|
|
368
|
+
}
|
|
369
|
+
}
|
|
472
370
|
//--------------------------------------
|
|
473
371
|
// RXWaitUntilComplete
|
|
474
372
|
//--------------------------------------
|
|
475
373
|
/*
|
|
476
374
|
* wait until all publishers are complete and then send a value of the last publisher if it's specified
|
|
477
375
|
* */
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
376
|
+
export class RXWaitUntilComplete extends RXPublisher {
|
|
377
|
+
get value() { return this._value; }
|
|
378
|
+
get err() { return this._err; }
|
|
379
|
+
constructor(list, resultPublisher) {
|
|
380
|
+
super();
|
|
381
|
+
this._value = undefined;
|
|
382
|
+
this._hasError = false;
|
|
383
|
+
this._err = undefined;
|
|
384
|
+
this._resultPublisher = resultPublisher;
|
|
385
|
+
let count = Array.isArray(list) ? list.length : 1;
|
|
487
386
|
if (Array.isArray(list)) {
|
|
488
|
-
list.forEach(
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
.subscribe();
|
|
501
|
-
});
|
|
387
|
+
list.forEach(ob => ob.pipe()
|
|
388
|
+
.onError(e => {
|
|
389
|
+
this._err = e;
|
|
390
|
+
this._hasError = true;
|
|
391
|
+
super.sendError(e);
|
|
392
|
+
})
|
|
393
|
+
.onComplete(() => {
|
|
394
|
+
count--;
|
|
395
|
+
if (count === 0)
|
|
396
|
+
this.subscribeToResultPublisher();
|
|
397
|
+
})
|
|
398
|
+
.subscribe());
|
|
502
399
|
if (count === 0)
|
|
503
|
-
|
|
400
|
+
this.subscribeToResultPublisher();
|
|
504
401
|
}
|
|
505
402
|
else {
|
|
506
403
|
list.pipe()
|
|
507
|
-
.onError(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
404
|
+
.onError(e => {
|
|
405
|
+
this._err = e;
|
|
406
|
+
this._hasError = true;
|
|
407
|
+
super.sendError(e);
|
|
511
408
|
})
|
|
512
|
-
.onComplete(
|
|
513
|
-
|
|
409
|
+
.onComplete(() => {
|
|
410
|
+
this.subscribeToResultPublisher();
|
|
514
411
|
})
|
|
515
412
|
.subscribe();
|
|
516
413
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
Object.defineProperty(RXWaitUntilComplete.prototype, "value", {
|
|
520
|
-
get: function () { return this._value; },
|
|
521
|
-
enumerable: false,
|
|
522
|
-
configurable: true
|
|
523
|
-
});
|
|
524
|
-
Object.defineProperty(RXWaitUntilComplete.prototype, "err", {
|
|
525
|
-
get: function () { return this._err; },
|
|
526
|
-
enumerable: false,
|
|
527
|
-
configurable: true
|
|
528
|
-
});
|
|
529
|
-
RXWaitUntilComplete.prototype.subscribeToResultPublisher = function () {
|
|
530
|
-
var _this = this;
|
|
414
|
+
}
|
|
415
|
+
subscribeToResultPublisher() {
|
|
531
416
|
if (this._resultPublisher) {
|
|
532
417
|
this._resultPublisher.pipe()
|
|
533
|
-
.onReceive(
|
|
534
|
-
|
|
535
|
-
|
|
418
|
+
.onReceive(v => {
|
|
419
|
+
this._value = v;
|
|
420
|
+
super.send(v);
|
|
536
421
|
})
|
|
537
|
-
.onError(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
422
|
+
.onError((e) => {
|
|
423
|
+
this._err = e;
|
|
424
|
+
this._hasError = true;
|
|
425
|
+
super.sendError(e);
|
|
541
426
|
})
|
|
542
|
-
.onComplete(
|
|
543
|
-
|
|
544
|
-
|
|
427
|
+
.onComplete(() => {
|
|
428
|
+
this._isComplete = true;
|
|
429
|
+
super.sendComplete();
|
|
545
430
|
})
|
|
546
431
|
.subscribe();
|
|
547
432
|
}
|
|
548
433
|
else {
|
|
549
434
|
this._isComplete = true;
|
|
550
|
-
|
|
435
|
+
super.sendComplete();
|
|
551
436
|
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
!this._hasError && this.isComplete && ((_a = this._resultPublisher) === null || _a === void 0 ? void 0 : _a.isComplete) && p.send(this.value, false);
|
|
437
|
+
}
|
|
438
|
+
didSubscribe(p) {
|
|
439
|
+
!this._hasError && this.isComplete && this._resultPublisher?.isComplete && p.send(this.value, false);
|
|
556
440
|
this._hasError && p.sendError(this.err, false);
|
|
557
441
|
this.isComplete && p.sendComplete(false);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
}(RXPublisher));
|
|
561
|
-
export { RXWaitUntilComplete };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
562
444
|
/*
|
|
563
445
|
*
|
|
564
446
|
* UI
|
|
@@ -567,57 +449,43 @@ export { RXWaitUntilComplete };
|
|
|
567
449
|
//--------------------------------------
|
|
568
450
|
// RXObservableEntity
|
|
569
451
|
//--------------------------------------
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
function RXObservableEntity() {
|
|
573
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
574
|
-
}
|
|
575
|
-
RXObservableEntity.prototype.mutated = function () {
|
|
452
|
+
export class RXObservableEntity extends RXPublisher {
|
|
453
|
+
mutated() {
|
|
576
454
|
this.send(this);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
|
|
455
|
+
}
|
|
456
|
+
send(value) {
|
|
457
|
+
super.send(value);
|
|
458
|
+
}
|
|
459
|
+
dispose() {
|
|
582
460
|
this.sendComplete();
|
|
583
|
-
}
|
|
584
|
-
|
|
461
|
+
}
|
|
462
|
+
didSubscribe(p) {
|
|
585
463
|
p.send(this, false);
|
|
586
464
|
this.isComplete && p.sendComplete(false);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
}(RXPublisher));
|
|
590
|
-
export { RXObservableEntity };
|
|
465
|
+
}
|
|
466
|
+
}
|
|
591
467
|
//--------------------------------------
|
|
592
468
|
// RXMutableValue
|
|
593
469
|
//--------------------------------------
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
enumerable: false,
|
|
610
|
-
configurable: true
|
|
611
|
-
});
|
|
612
|
-
RXObservableValue.prototype.didSubscribe = function (p) {
|
|
470
|
+
export class RXObservableValue extends RXPublisher {
|
|
471
|
+
get value() { return this._value; }
|
|
472
|
+
set value(value) {
|
|
473
|
+
if (value !== this._value) {
|
|
474
|
+
this._value = value;
|
|
475
|
+
super.send(value);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
constructor(value) {
|
|
479
|
+
super();
|
|
480
|
+
this._value = value;
|
|
481
|
+
}
|
|
482
|
+
didSubscribe(p) {
|
|
613
483
|
p.send(this.value, false);
|
|
614
484
|
this.isComplete && p.sendComplete(false);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
var RXQueueOperator = /** @class */ (function () {
|
|
620
|
-
function RXQueueOperator(op) {
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
export class RXQueueOperator {
|
|
488
|
+
constructor(op) {
|
|
621
489
|
this.inProgress = true;
|
|
622
490
|
this.value = undefined;
|
|
623
491
|
this.op = op;
|
|
@@ -625,98 +493,78 @@ var RXQueueOperator = /** @class */ (function () {
|
|
|
625
493
|
//--------------------------------------
|
|
626
494
|
// RXSender Protocol
|
|
627
495
|
//--------------------------------------
|
|
628
|
-
|
|
629
|
-
var _a;
|
|
496
|
+
send(value) {
|
|
630
497
|
if (!this.op.isComplete) {
|
|
631
|
-
|
|
498
|
+
this.child?.send(value);
|
|
632
499
|
}
|
|
633
|
-
}
|
|
500
|
+
}
|
|
634
501
|
//--------------------------------------
|
|
635
502
|
// OPERATORS
|
|
636
503
|
//--------------------------------------
|
|
637
|
-
|
|
638
|
-
|
|
504
|
+
next(f) {
|
|
505
|
+
const operator = this.addChild(new RXQueueNext(this.op, f));
|
|
639
506
|
if (!this.inProgress) {
|
|
640
507
|
operator.send(this.value);
|
|
641
508
|
}
|
|
642
509
|
return operator;
|
|
643
|
-
}
|
|
644
|
-
|
|
510
|
+
}
|
|
511
|
+
addChild(op) {
|
|
645
512
|
this.child = op;
|
|
646
513
|
return op;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
var _this = this;
|
|
514
|
+
}
|
|
515
|
+
complete() {
|
|
650
516
|
if (!this.op.isComplete) {
|
|
651
|
-
this.next(
|
|
652
|
-
|
|
653
|
-
return
|
|
517
|
+
this.next(res => {
|
|
518
|
+
this.op.success(res);
|
|
519
|
+
return this.op;
|
|
654
520
|
});
|
|
655
521
|
}
|
|
656
522
|
return this.op.asObservable;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
_this.mapper = mapper;
|
|
666
|
-
return _this;
|
|
667
|
-
}
|
|
668
|
-
RXQueueNext.prototype.send = function (value) {
|
|
669
|
-
var _this = this;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
class RXQueueNext extends RXQueueOperator {
|
|
526
|
+
constructor(op, mapper) {
|
|
527
|
+
super(op);
|
|
528
|
+
this.mapper = mapper;
|
|
529
|
+
}
|
|
530
|
+
send(value) {
|
|
670
531
|
if (this.op.isComplete)
|
|
671
532
|
return;
|
|
672
|
-
|
|
533
|
+
const rx = this.mapper(value);
|
|
673
534
|
rx.pipe()
|
|
674
|
-
.onReceive(
|
|
675
|
-
|
|
535
|
+
.onReceive((v) => {
|
|
536
|
+
this.value = v;
|
|
676
537
|
})
|
|
677
|
-
.onError(
|
|
678
|
-
|
|
538
|
+
.onError((e) => {
|
|
539
|
+
this.op.fail(e);
|
|
679
540
|
})
|
|
680
|
-
.onComplete(
|
|
681
|
-
|
|
682
|
-
|
|
541
|
+
.onComplete(() => {
|
|
542
|
+
this.inProgress = false;
|
|
543
|
+
super.send(this.value);
|
|
683
544
|
})
|
|
684
545
|
.subscribe();
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
//--------------------------------------
|
|
705
|
-
// isComplete
|
|
706
|
-
//--------------------------------------
|
|
707
|
-
get: function () { return this.op.isComplete; },
|
|
708
|
-
enumerable: false,
|
|
709
|
-
configurable: true
|
|
710
|
-
});
|
|
711
|
-
RXQueue.prototype.next = function (f) {
|
|
712
|
-
return _super.prototype.next.call(this, f);
|
|
713
|
-
};
|
|
714
|
-
RXQueue.prototype.success = function (v) {
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
export class RXQueue extends RXQueueOperator {
|
|
549
|
+
constructor() {
|
|
550
|
+
super(new RXOperation());
|
|
551
|
+
this.inProgress = false;
|
|
552
|
+
}
|
|
553
|
+
//--------------------------------------
|
|
554
|
+
// asObservable
|
|
555
|
+
//--------------------------------------
|
|
556
|
+
get asObservable() { return this.op.asObservable; }
|
|
557
|
+
//--------------------------------------
|
|
558
|
+
// isComplete
|
|
559
|
+
//--------------------------------------
|
|
560
|
+
get isComplete() { return this.op.isComplete; }
|
|
561
|
+
next(f) {
|
|
562
|
+
return super.next(f);
|
|
563
|
+
}
|
|
564
|
+
success(v) {
|
|
715
565
|
this.op.success(v);
|
|
716
|
-
}
|
|
717
|
-
|
|
566
|
+
}
|
|
567
|
+
fail(e) {
|
|
718
568
|
this.op.fail(e);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
}(RXQueueOperator));
|
|
722
|
-
export { RXQueue };
|
|
569
|
+
}
|
|
570
|
+
}
|