flinker 1.0.0 → 1.0.6

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