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