flinker 1.0.7 → 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 -7
- package/dist/index.d.ts +6 -7
- package/package.json +5 -9
- package/dist/RXObserver.d.ts +0 -33
- package/dist/cjs/RX.js +0 -41
- package/dist/cjs/RXObserver.js +0 -255
- 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 -50
- package/dist/esm/RXObserver.js +0 -249
package/dist/esm/RXOperator.js
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
var _a;
|
|
16
|
+
send(value, broadcast) {
|
|
37
17
|
if (!this.isComplete) {
|
|
38
|
-
|
|
18
|
+
this.child?.send(value, broadcast);
|
|
39
19
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var _a;
|
|
20
|
+
}
|
|
21
|
+
sendError(e, broadcast) {
|
|
43
22
|
if (!this.isComplete) {
|
|
44
|
-
|
|
23
|
+
this.child?.sendError(e, broadcast);
|
|
45
24
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
var _a;
|
|
25
|
+
}
|
|
26
|
+
sendComplete(broadcast) {
|
|
49
27
|
if (!this.isComplete) {
|
|
50
28
|
this._isComplete = true;
|
|
51
|
-
|
|
29
|
+
this.child?.sendComplete(broadcast);
|
|
52
30
|
}
|
|
53
|
-
}
|
|
31
|
+
}
|
|
54
32
|
//--------------------------------------
|
|
55
33
|
// OPERATORS
|
|
56
34
|
//--------------------------------------
|
|
57
|
-
|
|
35
|
+
skipFirst() {
|
|
58
36
|
return this.addChild(new RXSkipFirst(this.pipeline));
|
|
59
|
-
}
|
|
60
|
-
|
|
37
|
+
}
|
|
38
|
+
skipNullable() {
|
|
61
39
|
return this.addChild(new RXSkipNullable(this.pipeline));
|
|
62
|
-
}
|
|
63
|
-
|
|
40
|
+
}
|
|
41
|
+
removeDuplicates(value) {
|
|
64
42
|
return this.addChild(new RXRemoveDuplicates(this.pipeline, value));
|
|
65
|
-
}
|
|
66
|
-
|
|
43
|
+
}
|
|
44
|
+
debounce(ms) {
|
|
67
45
|
return this.addChild(new RXDebounce(this.pipeline, ms));
|
|
68
|
-
}
|
|
69
|
-
|
|
46
|
+
}
|
|
47
|
+
map(f) {
|
|
70
48
|
return this.addChild(new RXMap(this.pipeline, f));
|
|
71
|
-
}
|
|
72
|
-
|
|
49
|
+
}
|
|
50
|
+
flatMap(f) {
|
|
73
51
|
return this.addChild(new RXFlatMap(this.pipeline, f));
|
|
74
|
-
}
|
|
75
|
-
|
|
52
|
+
}
|
|
53
|
+
forEach(f) {
|
|
76
54
|
return this.addChild(new RXForEach(this.pipeline, f));
|
|
77
|
-
}
|
|
78
|
-
|
|
55
|
+
}
|
|
56
|
+
sequent(f) {
|
|
79
57
|
return this.addChild(new RXSequent(this.pipeline, f));
|
|
80
|
-
}
|
|
81
|
-
|
|
58
|
+
}
|
|
59
|
+
parallel(f) {
|
|
82
60
|
return this.addChild(new RXParallel(this.pipeline, f));
|
|
83
|
-
}
|
|
84
|
-
|
|
61
|
+
}
|
|
62
|
+
filter(predicate) {
|
|
85
63
|
return this.addChild(new RXFilter(this.pipeline, predicate));
|
|
86
|
-
}
|
|
87
|
-
|
|
64
|
+
}
|
|
65
|
+
spread() {
|
|
88
66
|
return this.addChild(new RXSpread(this.pipeline));
|
|
89
|
-
}
|
|
90
|
-
|
|
67
|
+
}
|
|
68
|
+
replaceError(replaceWith) {
|
|
91
69
|
return this.addChild(new RXReplaceError(this.pipeline, replaceWith));
|
|
92
|
-
}
|
|
93
|
-
|
|
70
|
+
}
|
|
71
|
+
addChild(op) {
|
|
94
72
|
this.child = op;
|
|
95
73
|
return op;
|
|
96
|
-
}
|
|
74
|
+
}
|
|
97
75
|
//--------------------------------------
|
|
98
76
|
// Output
|
|
99
77
|
//--------------------------------------
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
fork() {
|
|
79
|
+
const subscriber = new RXSubscriber(this.pipeline);
|
|
102
80
|
this.child = subscriber;
|
|
103
|
-
|
|
104
|
-
subscriber.onReceive(
|
|
105
|
-
subscriber.onError(
|
|
106
|
-
subscriber.onComplete(
|
|
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
|
-
|
|
111
|
-
|
|
87
|
+
}
|
|
88
|
+
onReceive(f) {
|
|
89
|
+
const subscriber = new RXSubscriber(this.pipeline);
|
|
112
90
|
this.child = subscriber;
|
|
113
91
|
return subscriber.onReceive(f);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
}
|
|
93
|
+
onError(f) {
|
|
94
|
+
const subscriber = new RXSubscriber(this.pipeline);
|
|
117
95
|
this.child = subscriber;
|
|
118
96
|
return subscriber.onError(f);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
97
|
+
}
|
|
98
|
+
onComplete(f) {
|
|
99
|
+
const subscriber = new RXSubscriber(this.pipeline);
|
|
122
100
|
this.child = subscriber;
|
|
123
101
|
return subscriber.onComplete(f);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}());
|
|
127
|
-
export { RXOperator };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
128
104
|
//--------------------------------------
|
|
129
105
|
// RXMap
|
|
130
106
|
//--------------------------------------
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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(
|
|
161
|
-
|
|
129
|
+
.onReceive(v => {
|
|
130
|
+
super.send(v, broadcast);
|
|
162
131
|
})
|
|
163
|
-
.onError(
|
|
164
|
-
|
|
132
|
+
.onError((e) => {
|
|
133
|
+
this.sendError(e, broadcast);
|
|
165
134
|
})
|
|
166
135
|
.subscribe();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
187
|
-
this.buffer.push({ hasError: true, error
|
|
150
|
+
}
|
|
151
|
+
sendError(error, broadcast) {
|
|
152
|
+
this.buffer.push({ hasError: true, error, broadcast });
|
|
188
153
|
this.processNext();
|
|
189
|
-
}
|
|
190
|
-
|
|
154
|
+
}
|
|
155
|
+
sendComplete(broadcast) {
|
|
191
156
|
this.willComplete = true;
|
|
192
157
|
this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
|
|
193
158
|
this.processNext();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var _this = this;
|
|
159
|
+
}
|
|
160
|
+
processNext() {
|
|
197
161
|
if (!this.curOp.isComplete)
|
|
198
162
|
return;
|
|
199
|
-
|
|
163
|
+
const notification = this.buffer.shift();
|
|
200
164
|
if (notification) {
|
|
201
165
|
if (notification.hasError) {
|
|
202
|
-
|
|
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(
|
|
209
|
-
|
|
172
|
+
.onReceive(v => {
|
|
173
|
+
super.send(v, notification.broadcast);
|
|
210
174
|
})
|
|
211
|
-
.onError(
|
|
212
|
-
|
|
175
|
+
.onError((e) => {
|
|
176
|
+
super.sendError(e, notification.broadcast);
|
|
213
177
|
})
|
|
214
|
-
.onComplete(
|
|
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
|
-
|
|
187
|
+
super.sendComplete(this.willCompleteBroadcast);
|
|
224
188
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
245
|
-
this.buffer.push({ hasError: true, error
|
|
203
|
+
}
|
|
204
|
+
sendError(error, broadcast) {
|
|
205
|
+
this.buffer.push({ hasError: true, error, broadcast });
|
|
246
206
|
this.processNext();
|
|
247
|
-
}
|
|
248
|
-
|
|
207
|
+
}
|
|
208
|
+
sendComplete(broadcast) {
|
|
249
209
|
this.willComplete = true;
|
|
250
210
|
this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
|
|
251
211
|
this.processNext();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var _this = this;
|
|
212
|
+
}
|
|
213
|
+
processNext() {
|
|
255
214
|
if (!this.curOp.isComplete)
|
|
256
215
|
return;
|
|
257
|
-
|
|
216
|
+
const notification = this.buffer.shift();
|
|
258
217
|
if (notification) {
|
|
259
218
|
if (notification.hasError) {
|
|
260
|
-
|
|
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(
|
|
267
|
-
|
|
225
|
+
.onReceive(v => {
|
|
226
|
+
super.send(v, notification.broadcast);
|
|
268
227
|
})
|
|
269
|
-
.onError(
|
|
270
|
-
|
|
228
|
+
.onError((e) => {
|
|
229
|
+
super.sendError(e, notification.broadcast);
|
|
271
230
|
})
|
|
272
|
-
.onComplete(
|
|
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
|
-
|
|
240
|
+
super.sendComplete(this.willCompleteBroadcast);
|
|
282
241
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
}(RXOperator));
|
|
286
|
-
export { RXSequent };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
287
244
|
//--------------------------------------
|
|
288
245
|
// RXParallel
|
|
289
246
|
//--------------------------------------
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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(
|
|
305
|
-
|
|
258
|
+
.onReceive(v => {
|
|
259
|
+
super.send(v, broadcast);
|
|
306
260
|
})
|
|
307
|
-
.onError(
|
|
308
|
-
|
|
261
|
+
.onError((e) => {
|
|
262
|
+
super.sendError(e, broadcast);
|
|
309
263
|
})
|
|
310
|
-
.onComplete(
|
|
311
|
-
|
|
312
|
-
if (
|
|
313
|
-
|
|
264
|
+
.onComplete(() => {
|
|
265
|
+
this.activeOperations--;
|
|
266
|
+
if (this.activeOperations === 0 && this.willComplete)
|
|
267
|
+
super.sendComplete(this.willCompleteBroadcast);
|
|
314
268
|
})
|
|
315
269
|
.subscribe();
|
|
316
|
-
}
|
|
317
|
-
|
|
270
|
+
}
|
|
271
|
+
sendComplete(broadcast) {
|
|
318
272
|
this.willComplete = true;
|
|
319
273
|
this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
|
|
320
274
|
if (this.activeOperations === 0) {
|
|
321
|
-
|
|
275
|
+
super.sendComplete(broadcast);
|
|
322
276
|
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
}(RXOperator));
|
|
326
|
-
export { RXParallel };
|
|
277
|
+
}
|
|
278
|
+
}
|
|
327
279
|
//--------------------------------------
|
|
328
280
|
// RXFilter
|
|
329
281
|
//--------------------------------------
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
}(RXOperator));
|
|
343
|
-
export { RXFilter };
|
|
289
|
+
super.send(value, broadcast);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
344
292
|
//--------------------------------------
|
|
345
293
|
// RXSpread
|
|
346
294
|
//--------------------------------------
|
|
347
|
-
|
|
348
|
-
|
|
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(
|
|
356
|
-
|
|
298
|
+
value.forEach(v => {
|
|
299
|
+
super.send(v, broadcast);
|
|
357
300
|
});
|
|
358
301
|
}
|
|
359
302
|
else
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
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
|
-
|
|
370
|
-
|
|
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
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
}(RXOperator));
|
|
380
|
-
export { RXSkipFirst };
|
|
313
|
+
super.send(value, broadcast);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
381
316
|
//--------------------------------------
|
|
382
317
|
// RXSkipNullable
|
|
383
318
|
//--------------------------------------
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
}(RXOperator));
|
|
395
|
-
export { RXSkipNullable };
|
|
322
|
+
super.send(value, broadcast);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
396
325
|
//--------------------------------------
|
|
397
326
|
// RXRemoveDuplicates
|
|
398
327
|
//--------------------------------------
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
337
|
+
super.send(value, broadcast);
|
|
411
338
|
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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(
|
|
432
|
-
|
|
433
|
-
for (
|
|
434
|
-
|
|
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
|
-
|
|
358
|
+
super.sendError(notification.error, notification.broadcast);
|
|
437
359
|
}
|
|
438
360
|
else {
|
|
439
|
-
|
|
361
|
+
super.send(notification.value, notification.broadcast);
|
|
440
362
|
}
|
|
441
363
|
//if (notification.broadcast) break
|
|
442
364
|
break;
|
|
443
365
|
}
|
|
444
|
-
|
|
445
|
-
if (
|
|
446
|
-
|
|
366
|
+
this.buffer.length = 0;
|
|
367
|
+
if (this.willComplete)
|
|
368
|
+
super.sendComplete(this.willCompleteBroadcast);
|
|
447
369
|
}, this.ms);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
this.buffer.push({ hasError: false, value
|
|
370
|
+
}
|
|
371
|
+
send(value, broadcast) {
|
|
372
|
+
this.buffer.push({ hasError: false, value, broadcast });
|
|
451
373
|
this.startTimer();
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
this.buffer.push({ hasError: true, error
|
|
374
|
+
}
|
|
375
|
+
sendError(error, broadcast) {
|
|
376
|
+
this.buffer.push({ hasError: true, error, broadcast });
|
|
455
377
|
this.startTimer();
|
|
456
|
-
}
|
|
457
|
-
|
|
378
|
+
}
|
|
379
|
+
sendComplete(broadcast) {
|
|
458
380
|
this.willComplete = true;
|
|
459
381
|
this.willCompleteBroadcast || (this.willCompleteBroadcast = broadcast);
|
|
460
382
|
this.startTimer();
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
}(RXOperator));
|
|
464
|
-
export { RXDebounce };
|
|
383
|
+
}
|
|
384
|
+
}
|
|
465
385
|
//--------------------------------------
|
|
466
386
|
// RXReplaceError
|
|
467
387
|
//--------------------------------------
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
+
}
|