flinker 2.0.0 → 2.0.2

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.
@@ -1,22 +1,7 @@
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 { RXEmitter, RXJustComplete } from './RXPublisher.js';
17
- import { RXSubscriber } from './RXSubscriber.js';
18
- var RXOperator = /** @class */ (function () {
19
- function RXOperator(pipeline) {
1
+ import { RXEmitter, RXJustComplete } from './RXPublisher';
2
+ import { RXSubscriber } from './RXSubscriber';
3
+ export class RXOperator {
4
+ constructor(pipeline) {
20
5
  this.type = 'operator';
21
6
  //--------------------------------------
22
7
  // isComplete
@@ -24,194 +9,173 @@ var RXOperator = /** @class */ (function () {
24
9
  this._isComplete = false;
25
10
  this.pipeline = pipeline;
26
11
  }
27
- Object.defineProperty(RXOperator.prototype, "isComplete", {
28
- get: function () { return this._isComplete; },
29
- enumerable: false,
30
- configurable: true
31
- });
12
+ get isComplete() { return this._isComplete; }
32
13
  //--------------------------------------
33
14
  // RXSender Protocol
34
15
  //--------------------------------------
35
- RXOperator.prototype.send = function (value, broadcast) {
36
- var _a;
16
+ send(value, broadcast) {
37
17
  if (!this.isComplete) {
38
- (_a = this.child) === null || _a === void 0 ? void 0 : _a.send(value, broadcast);
18
+ this.child?.send(value, broadcast);
39
19
  }
40
- };
41
- RXOperator.prototype.sendError = function (e, broadcast) {
42
- var _a;
20
+ }
21
+ sendError(e, broadcast) {
43
22
  if (!this.isComplete) {
44
- (_a = this.child) === null || _a === void 0 ? void 0 : _a.sendError(e, broadcast);
23
+ this.child?.sendError(e, broadcast);
45
24
  }
46
- };
47
- RXOperator.prototype.sendComplete = function (broadcast) {
48
- var _a;
25
+ }
26
+ sendComplete(broadcast) {
49
27
  if (!this.isComplete) {
50
28
  this._isComplete = true;
51
- (_a = this.child) === null || _a === void 0 ? void 0 : _a.sendComplete(broadcast);
29
+ this.child?.sendComplete(broadcast);
52
30
  }
53
- };
31
+ }
54
32
  //--------------------------------------
55
33
  // OPERATORS
56
34
  //--------------------------------------
57
- RXOperator.prototype.skipFirst = function () {
35
+ skipFirst() {
58
36
  return this.addChild(new RXSkipFirst(this.pipeline));
59
- };
60
- RXOperator.prototype.skipNullable = function () {
37
+ }
38
+ skipNullable() {
61
39
  return this.addChild(new RXSkipNullable(this.pipeline));
62
- };
63
- RXOperator.prototype.removeDuplicates = function (value) {
40
+ }
41
+ removeDuplicates(value) {
64
42
  return this.addChild(new RXRemoveDuplicates(this.pipeline, value));
65
- };
66
- RXOperator.prototype.debounce = function (ms) {
43
+ }
44
+ debounce(ms) {
67
45
  return this.addChild(new RXDebounce(this.pipeline, ms));
68
- };
69
- RXOperator.prototype.map = function (f) {
46
+ }
47
+ map(f) {
70
48
  return this.addChild(new RXMap(this.pipeline, f));
71
- };
72
- RXOperator.prototype.flatMap = function (f) {
49
+ }
50
+ flatMap(f) {
73
51
  return this.addChild(new RXFlatMap(this.pipeline, f));
74
- };
75
- RXOperator.prototype.forEach = function (f) {
52
+ }
53
+ forEach(f) {
76
54
  return this.addChild(new RXForEach(this.pipeline, f));
77
- };
78
- RXOperator.prototype.sequent = function (f) {
55
+ }
56
+ sequent(f) {
79
57
  return this.addChild(new RXSequent(this.pipeline, f));
80
- };
81
- RXOperator.prototype.parallel = function (f) {
58
+ }
59
+ parallel(f) {
82
60
  return this.addChild(new RXParallel(this.pipeline, f));
83
- };
84
- RXOperator.prototype.filter = function (predicate) {
61
+ }
62
+ filter(predicate) {
85
63
  return this.addChild(new RXFilter(this.pipeline, predicate));
86
- };
87
- RXOperator.prototype.spread = function () {
64
+ }
65
+ spread() {
88
66
  return this.addChild(new RXSpread(this.pipeline));
89
- };
90
- RXOperator.prototype.replaceError = function (replaceWith) {
67
+ }
68
+ replaceError(replaceWith) {
91
69
  return this.addChild(new RXReplaceError(this.pipeline, replaceWith));
92
- };
93
- RXOperator.prototype.addChild = function (op) {
70
+ }
71
+ addChild(op) {
94
72
  this.child = op;
95
73
  return op;
96
- };
74
+ }
97
75
  //--------------------------------------
98
76
  // Output
99
77
  //--------------------------------------
100
- RXOperator.prototype.fork = function () {
101
- var subscriber = new RXSubscriber(this.pipeline);
78
+ fork() {
79
+ const subscriber = new RXSubscriber(this.pipeline);
102
80
  this.child = subscriber;
103
- var dispatcher = new RXEmitter();
104
- subscriber.onReceive(function (v) { dispatcher.send(v); });
105
- subscriber.onError(function (e) { dispatcher.sendError(e); });
106
- subscriber.onComplete(function () { dispatcher.sendComplete(); });
81
+ const dispatcher = new RXEmitter();
82
+ subscriber.onReceive((v) => { dispatcher.send(v); });
83
+ subscriber.onError((e) => { dispatcher.sendError(e); });
84
+ subscriber.onComplete(() => { dispatcher.sendComplete(); });
107
85
  subscriber.subscribe();
108
86
  return dispatcher.asObservable;
109
- };
110
- RXOperator.prototype.onReceive = function (f) {
111
- var subscriber = new RXSubscriber(this.pipeline);
87
+ }
88
+ onReceive(f) {
89
+ const subscriber = new RXSubscriber(this.pipeline);
112
90
  this.child = subscriber;
113
91
  return subscriber.onReceive(f);
114
- };
115
- RXOperator.prototype.onError = function (f) {
116
- var subscriber = new RXSubscriber(this.pipeline);
92
+ }
93
+ onError(f) {
94
+ const subscriber = new RXSubscriber(this.pipeline);
117
95
  this.child = subscriber;
118
96
  return subscriber.onError(f);
119
- };
120
- RXOperator.prototype.onComplete = function (f) {
121
- var subscriber = new RXSubscriber(this.pipeline);
97
+ }
98
+ onComplete(f) {
99
+ const subscriber = new RXSubscriber(this.pipeline);
122
100
  this.child = subscriber;
123
101
  return subscriber.onComplete(f);
124
- };
125
- return RXOperator;
126
- }());
127
- export { RXOperator };
102
+ }
103
+ }
128
104
  //--------------------------------------
129
105
  // RXMap
130
106
  //--------------------------------------
131
- var RXMap = /** @class */ (function (_super) {
132
- __extends(RXMap, _super);
133
- function RXMap(pipe, mapper) {
134
- var _this = _super.call(this, pipe) || this;
135
- _this.mapper = mapper;
136
- return _this;
137
- }
138
- RXMap.prototype.send = function (value, broadcast) {
139
- var newValue = this.mapper(value);
140
- _super.prototype.send.call(this, newValue, broadcast);
141
- };
142
- return RXMap;
143
- }(RXOperator));
144
- export { RXMap };
107
+ export class RXMap extends RXOperator {
108
+ constructor(pipe, mapper) {
109
+ super(pipe);
110
+ this.mapper = mapper;
111
+ }
112
+ send(value, broadcast) {
113
+ const newValue = this.mapper(value);
114
+ super.send(newValue, broadcast);
115
+ }
116
+ }
145
117
  //--------------------------------------
146
118
  // RXFlatMap
147
119
  //--------------------------------------
148
- var RXFlatMap = /** @class */ (function (_super) {
149
- __extends(RXFlatMap, _super);
150
- function RXFlatMap(pipe, mapper) {
151
- var _this = _super.call(this, pipe) || this;
152
- _this.mapper = mapper;
153
- return _this;
154
- }
155
- RXFlatMap.prototype.send = function (value, broadcast) {
156
- var _this = this;
120
+ export class RXFlatMap extends RXOperator {
121
+ constructor(pipe, mapper) {
122
+ super(pipe);
123
+ this.mapper = mapper;
124
+ }
125
+ send(value, broadcast) {
157
126
  if (this.isComplete)
158
127
  return;
159
128
  this.mapper(value).pipe()
160
- .onReceive(function (v) {
161
- _super.prototype.send.call(_this, v, broadcast);
129
+ .onReceive(v => {
130
+ super.send(v, broadcast);
162
131
  })
163
- .onError(function (e) {
164
- _this.sendError(e, broadcast);
132
+ .onError((e) => {
133
+ this.sendError(e, broadcast);
165
134
  })
166
135
  .subscribe();
167
- };
168
- return RXFlatMap;
169
- }(RXOperator));
170
- export { RXFlatMap };
171
- var RXForEach = /** @class */ (function (_super) {
172
- __extends(RXForEach, _super);
173
- function RXForEach(pipe, mapper) {
174
- var _this = _super.call(this, pipe) || this;
175
- _this.buffer = Array();
176
- _this.willComplete = false;
177
- _this.willCompleteBroadcast = false;
178
- _this.curOp = new RXJustComplete();
179
- _this.mapper = mapper;
180
- return _this;
181
- }
182
- RXForEach.prototype.send = function (value, broadcast) {
183
- this.buffer.push({ hasError: false, value: value, broadcast: broadcast });
136
+ }
137
+ }
138
+ export class RXForEach extends RXOperator {
139
+ constructor(pipe, mapper) {
140
+ super(pipe);
141
+ this.buffer = Array();
142
+ this.willComplete = false;
143
+ this.willCompleteBroadcast = false;
144
+ this.curOp = new RXJustComplete();
145
+ this.mapper = mapper;
146
+ }
147
+ send(value, broadcast) {
148
+ this.buffer.push({ hasError: false, value, broadcast });
184
149
  this.processNext();
185
- };
186
- RXForEach.prototype.sendError = function (error, broadcast) {
187
- this.buffer.push({ hasError: true, error: error, broadcast: broadcast });
150
+ }
151
+ sendError(error, broadcast) {
152
+ this.buffer.push({ hasError: true, error, broadcast });
188
153
  this.processNext();
189
- };
190
- RXForEach.prototype.sendComplete = function (broadcast) {
154
+ }
155
+ sendComplete(broadcast) {
191
156
  this.willComplete = true;
192
157
  this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
193
158
  this.processNext();
194
- };
195
- RXForEach.prototype.processNext = function () {
196
- var _this = this;
159
+ }
160
+ processNext() {
197
161
  if (!this.curOp.isComplete)
198
162
  return;
199
- var notification = this.buffer.shift();
163
+ const notification = this.buffer.shift();
200
164
  if (notification) {
201
165
  if (notification.hasError) {
202
- _super.prototype.sendError.call(this, notification.error, notification.broadcast);
166
+ super.sendError(notification.error, notification.broadcast);
203
167
  this.processNext();
204
168
  }
205
169
  else if (notification.value !== undefined) {
206
170
  this.curOp = this.mapper(notification.value);
207
171
  this.curOp.pipe()
208
- .onReceive(function (v) {
209
- _super.prototype.send.call(_this, v, notification.broadcast);
172
+ .onReceive(v => {
173
+ super.send(v, notification.broadcast);
210
174
  })
211
- .onError(function (e) {
212
- _super.prototype.sendError.call(_this, e, notification.broadcast);
175
+ .onError((e) => {
176
+ super.sendError(e, notification.broadcast);
213
177
  })
214
- .onComplete(function () { _this.processNext(); })
178
+ .onComplete(() => { this.processNext(); })
215
179
  .subscribe();
216
180
  }
217
181
  else {
@@ -220,56 +184,51 @@ var RXForEach = /** @class */ (function (_super) {
220
184
  }
221
185
  else {
222
186
  if (this.willComplete)
223
- _super.prototype.sendComplete.call(this, this.willCompleteBroadcast);
187
+ super.sendComplete(this.willCompleteBroadcast);
224
188
  }
225
- };
226
- return RXForEach;
227
- }(RXOperator));
228
- export { RXForEach };
229
- var RXSequent = /** @class */ (function (_super) {
230
- __extends(RXSequent, _super);
231
- function RXSequent(pipe, mapper) {
232
- var _this = _super.call(this, pipe) || this;
233
- _this.buffer = Array();
234
- _this.willComplete = false;
235
- _this.willCompleteBroadcast = false;
236
- _this.curOp = new RXJustComplete();
237
- _this.mapper = mapper;
238
- return _this;
239
- }
240
- RXSequent.prototype.send = function (value, broadcast) {
241
- this.buffer.push({ hasError: false, value: value, broadcast: broadcast });
189
+ }
190
+ }
191
+ export class RXSequent extends RXOperator {
192
+ constructor(pipe, mapper) {
193
+ super(pipe);
194
+ this.buffer = Array();
195
+ this.willComplete = false;
196
+ this.willCompleteBroadcast = false;
197
+ this.curOp = new RXJustComplete();
198
+ this.mapper = mapper;
199
+ }
200
+ send(value, broadcast) {
201
+ this.buffer.push({ hasError: false, value, broadcast });
242
202
  this.processNext();
243
- };
244
- RXSequent.prototype.sendError = function (error, broadcast) {
245
- this.buffer.push({ hasError: true, error: error, broadcast: broadcast });
203
+ }
204
+ sendError(error, broadcast) {
205
+ this.buffer.push({ hasError: true, error, broadcast });
246
206
  this.processNext();
247
- };
248
- RXSequent.prototype.sendComplete = function (broadcast) {
207
+ }
208
+ sendComplete(broadcast) {
249
209
  this.willComplete = true;
250
210
  this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
251
211
  this.processNext();
252
- };
253
- RXSequent.prototype.processNext = function () {
254
- var _this = this;
212
+ }
213
+ processNext() {
255
214
  if (!this.curOp.isComplete)
256
215
  return;
257
- var notification = this.buffer.shift();
216
+ const notification = this.buffer.shift();
258
217
  if (notification) {
259
218
  if (notification.hasError) {
260
- _super.prototype.sendError.call(this, notification.error, notification.broadcast);
219
+ super.sendError(notification.error, notification.broadcast);
261
220
  this.processNext();
262
221
  }
263
222
  else if (notification.value !== undefined) {
264
223
  this.curOp = this.mapper(notification.value);
265
224
  this.curOp.pipe()
266
- .onReceive(function (v) {
267
- _super.prototype.send.call(_this, v, notification.broadcast);
225
+ .onReceive(v => {
226
+ super.send(v, notification.broadcast);
268
227
  })
269
- .onError(function (e) {
270
- _super.prototype.sendError.call(_this, e, notification.broadcast);
228
+ .onError((e) => {
229
+ super.sendError(e, notification.broadcast);
271
230
  })
272
- .onComplete(function () { _this.processNext(); })
231
+ .onComplete(() => { this.processNext(); })
273
232
  .subscribe();
274
233
  }
275
234
  else {
@@ -278,204 +237,161 @@ var RXSequent = /** @class */ (function (_super) {
278
237
  }
279
238
  else {
280
239
  if (this.willComplete)
281
- _super.prototype.sendComplete.call(this, this.willCompleteBroadcast);
240
+ super.sendComplete(this.willCompleteBroadcast);
282
241
  }
283
- };
284
- return RXSequent;
285
- }(RXOperator));
286
- export { RXSequent };
242
+ }
243
+ }
287
244
  //--------------------------------------
288
245
  // RXParallel
289
246
  //--------------------------------------
290
- var RXParallel = /** @class */ (function (_super) {
291
- __extends(RXParallel, _super);
292
- function RXParallel(pipe, mapper) {
293
- var _this = _super.call(this, pipe) || this;
294
- _this.willComplete = false;
295
- _this.willCompleteBroadcast = false;
296
- _this.activeOperations = 0;
297
- _this.mapper = mapper;
298
- return _this;
299
- }
300
- RXParallel.prototype.send = function (value, broadcast) {
301
- var _this = this;
247
+ export class RXParallel extends RXOperator {
248
+ constructor(pipe, mapper) {
249
+ super(pipe);
250
+ this.willComplete = false;
251
+ this.willCompleteBroadcast = false;
252
+ this.activeOperations = 0;
253
+ this.mapper = mapper;
254
+ }
255
+ send(value, broadcast) {
302
256
  this.activeOperations++;
303
257
  this.mapper(value).pipe()
304
- .onReceive(function (v) {
305
- _super.prototype.send.call(_this, v, broadcast);
258
+ .onReceive(v => {
259
+ super.send(v, broadcast);
306
260
  })
307
- .onError(function (e) {
308
- _super.prototype.sendError.call(_this, e, broadcast);
261
+ .onError((e) => {
262
+ super.sendError(e, broadcast);
309
263
  })
310
- .onComplete(function () {
311
- _this.activeOperations--;
312
- if (_this.activeOperations === 0 && _this.willComplete)
313
- _super.prototype.sendComplete.call(_this, _this.willCompleteBroadcast);
264
+ .onComplete(() => {
265
+ this.activeOperations--;
266
+ if (this.activeOperations === 0 && this.willComplete)
267
+ super.sendComplete(this.willCompleteBroadcast);
314
268
  })
315
269
  .subscribe();
316
- };
317
- RXParallel.prototype.sendComplete = function (broadcast) {
270
+ }
271
+ sendComplete(broadcast) {
318
272
  this.willComplete = true;
319
273
  this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
320
274
  if (this.activeOperations === 0) {
321
- _super.prototype.sendComplete.call(this, broadcast);
275
+ super.sendComplete(broadcast);
322
276
  }
323
- };
324
- return RXParallel;
325
- }(RXOperator));
326
- export { RXParallel };
277
+ }
278
+ }
327
279
  //--------------------------------------
328
280
  // RXFilter
329
281
  //--------------------------------------
330
- var RXFilter = /** @class */ (function (_super) {
331
- __extends(RXFilter, _super);
332
- function RXFilter(pipe, predicate) {
333
- var _this = _super.call(this, pipe) || this;
334
- _this.predicate = predicate;
335
- return _this;
336
- }
337
- RXFilter.prototype.send = function (value, broadcast) {
282
+ export class RXFilter extends RXOperator {
283
+ constructor(pipe, predicate) {
284
+ super(pipe);
285
+ this.predicate = predicate;
286
+ }
287
+ send(value, broadcast) {
338
288
  if (this.predicate(value))
339
- _super.prototype.send.call(this, value, broadcast);
340
- };
341
- return RXFilter;
342
- }(RXOperator));
343
- export { RXFilter };
289
+ super.send(value, broadcast);
290
+ }
291
+ }
344
292
  //--------------------------------------
345
293
  // RXSpread
346
294
  //--------------------------------------
347
- var RXSpread = /** @class */ (function (_super) {
348
- __extends(RXSpread, _super);
349
- function RXSpread() {
350
- return _super !== null && _super.apply(this, arguments) || this;
351
- }
352
- RXSpread.prototype.send = function (value, broadcast) {
353
- var _this = this;
295
+ export class RXSpread extends RXOperator {
296
+ send(value, broadcast) {
354
297
  if (Array.isArray(value)) {
355
- value.forEach(function (v) {
356
- _super.prototype.send.call(_this, v, broadcast);
298
+ value.forEach(v => {
299
+ super.send(v, broadcast);
357
300
  });
358
301
  }
359
302
  else
360
- _super.prototype.send.call(this, value, broadcast);
361
- };
362
- return RXSpread;
363
- }(RXOperator));
364
- export { RXSpread };
303
+ super.send(value, broadcast);
304
+ }
305
+ }
365
306
  //--------------------------------------
366
307
  // RXSkipFirst
367
308
  //--------------------------------------
368
309
  //ignore value emitted just after registration of a new subscriber
369
- var RXSkipFirst = /** @class */ (function (_super) {
370
- __extends(RXSkipFirst, _super);
371
- function RXSkipFirst() {
372
- return _super !== null && _super.apply(this, arguments) || this;
373
- }
374
- RXSkipFirst.prototype.send = function (value, broadcast) {
310
+ export class RXSkipFirst extends RXOperator {
311
+ send(value, broadcast) {
375
312
  if (broadcast)
376
- _super.prototype.send.call(this, value, broadcast);
377
- };
378
- return RXSkipFirst;
379
- }(RXOperator));
380
- export { RXSkipFirst };
313
+ super.send(value, broadcast);
314
+ }
315
+ }
381
316
  //--------------------------------------
382
317
  // RXSkipNullable
383
318
  //--------------------------------------
384
- var RXSkipNullable = /** @class */ (function (_super) {
385
- __extends(RXSkipNullable, _super);
386
- function RXSkipNullable() {
387
- return _super !== null && _super.apply(this, arguments) || this;
388
- }
389
- RXSkipNullable.prototype.send = function (value, broadcast) {
319
+ export class RXSkipNullable extends RXOperator {
320
+ send(value, broadcast) {
390
321
  if (value !== null && value !== undefined)
391
- _super.prototype.send.call(this, value, broadcast);
392
- };
393
- return RXSkipNullable;
394
- }(RXOperator));
395
- export { RXSkipNullable };
322
+ super.send(value, broadcast);
323
+ }
324
+ }
396
325
  //--------------------------------------
397
326
  // RXRemoveDuplicates
398
327
  //--------------------------------------
399
- var RXRemoveDuplicates = /** @class */ (function (_super) {
400
- __extends(RXRemoveDuplicates, _super);
401
- function RXRemoveDuplicates(pipe, value) {
402
- var _this = _super.call(this, pipe) || this;
403
- _this.prevValue = undefined;
404
- _this.prevValue = value;
405
- return _this;
406
- }
407
- RXRemoveDuplicates.prototype.send = function (value, broadcast) {
328
+ export class RXRemoveDuplicates extends RXOperator {
329
+ constructor(pipe, value) {
330
+ super(pipe);
331
+ this.prevValue = undefined;
332
+ this.prevValue = value;
333
+ }
334
+ send(value, broadcast) {
408
335
  if (this.prevValue !== value) {
409
336
  this.prevValue = value;
410
- _super.prototype.send.call(this, value, broadcast);
337
+ super.send(value, broadcast);
411
338
  }
412
- };
413
- return RXRemoveDuplicates;
414
- }(RXOperator));
415
- export { RXRemoveDuplicates };
416
- var RXDebounce = /** @class */ (function (_super) {
417
- __extends(RXDebounce, _super);
418
- function RXDebounce(pipe, ms) {
419
- var _this = _super.call(this, pipe) || this;
420
- _this.buffer = Array();
421
- _this.willComplete = false;
422
- _this.willCompleteBroadcast = false;
423
- _this.timeoutId = undefined;
424
- _this.ms = ms;
425
- return _this;
426
- }
427
- RXDebounce.prototype.startTimer = function () {
428
- var _this = this;
339
+ }
340
+ }
341
+ export class RXDebounce extends RXOperator {
342
+ constructor(pipe, ms) {
343
+ super(pipe);
344
+ this.buffer = Array();
345
+ this.willComplete = false;
346
+ this.willCompleteBroadcast = false;
347
+ this.timeoutId = undefined;
348
+ this.ms = ms;
349
+ }
350
+ startTimer() {
429
351
  if (this.timeoutId)
430
352
  return;
431
- this.timeoutId = setTimeout(function () {
432
- _this.timeoutId = undefined;
433
- for (var i = _this.buffer.length - 1; i >= 0; i--) {
434
- var notification = _this.buffer[i];
353
+ this.timeoutId = setTimeout(() => {
354
+ this.timeoutId = undefined;
355
+ for (let i = this.buffer.length - 1; i >= 0; i--) {
356
+ const notification = this.buffer[i];
435
357
  if (notification.hasError) {
436
- _super.prototype.sendError.call(_this, notification.error, notification.broadcast);
358
+ super.sendError(notification.error, notification.broadcast);
437
359
  }
438
360
  else {
439
- _super.prototype.send.call(_this, notification.value, notification.broadcast);
361
+ super.send(notification.value, notification.broadcast);
440
362
  }
441
363
  //if (notification.broadcast) break
442
364
  break;
443
365
  }
444
- _this.buffer.length = 0;
445
- if (_this.willComplete)
446
- _super.prototype.sendComplete.call(_this, _this.willCompleteBroadcast);
366
+ this.buffer.length = 0;
367
+ if (this.willComplete)
368
+ super.sendComplete(this.willCompleteBroadcast);
447
369
  }, this.ms);
448
- };
449
- RXDebounce.prototype.send = function (value, broadcast) {
450
- this.buffer.push({ hasError: false, value: value, broadcast: broadcast });
370
+ }
371
+ send(value, broadcast) {
372
+ this.buffer.push({ hasError: false, value, broadcast });
451
373
  this.startTimer();
452
- };
453
- RXDebounce.prototype.sendError = function (error, broadcast) {
454
- this.buffer.push({ hasError: true, error: error, broadcast: broadcast });
374
+ }
375
+ sendError(error, broadcast) {
376
+ this.buffer.push({ hasError: true, error, broadcast });
455
377
  this.startTimer();
456
- };
457
- RXDebounce.prototype.sendComplete = function (broadcast) {
378
+ }
379
+ sendComplete(broadcast) {
458
380
  this.willComplete = true;
459
381
  this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
460
382
  this.startTimer();
461
- };
462
- return RXDebounce;
463
- }(RXOperator));
464
- export { RXDebounce };
383
+ }
384
+ }
465
385
  //--------------------------------------
466
386
  // RXReplaceError
467
387
  //--------------------------------------
468
- var RXReplaceError = /** @class */ (function (_super) {
469
- __extends(RXReplaceError, _super);
470
- function RXReplaceError(pipe, replaceWith) {
471
- var _this = _super.call(this, pipe) || this;
472
- _this.replaceWith = replaceWith;
473
- return _this;
474
- }
475
- RXReplaceError.prototype.sendError = function (e, broadcast) {
476
- var value = this.replaceWith(e);
477
- value ? this.send(value, broadcast) : _super.prototype.sendError.call(this, e, broadcast);
478
- };
479
- return RXReplaceError;
480
- }(RXOperator));
481
- export { RXReplaceError };
388
+ export class RXReplaceError extends RXOperator {
389
+ constructor(pipe, replaceWith) {
390
+ super(pipe);
391
+ this.replaceWith = replaceWith;
392
+ }
393
+ sendError(e, broadcast) {
394
+ const value = this.replaceWith(e);
395
+ value ? this.send(value, broadcast) : super.sendError(e, broadcast);
396
+ }
397
+ }