aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js')
-rw-r--r--node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js b/node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js
new file mode 100644
index 0000000..d18359b
--- /dev/null
+++ b/node_modules/rxjs/dist/esm5/internal/operators/bufferToggle.js
@@ -0,0 +1,45 @@
+import { __values } from "tslib";
+import { Subscription } from '../Subscription';
+import { operate } from '../util/lift';
+import { innerFrom } from '../observable/innerFrom';
+import { createOperatorSubscriber } from './OperatorSubscriber';
+import { noop } from '../util/noop';
+import { arrRemove } from '../util/arrRemove';
+export function bufferToggle(openings, closingSelector) {
+ return operate(function (source, subscriber) {
+ var buffers = [];
+ innerFrom(openings).subscribe(createOperatorSubscriber(subscriber, function (openValue) {
+ var buffer = [];
+ buffers.push(buffer);
+ var closingSubscription = new Subscription();
+ var emitBuffer = function () {
+ arrRemove(buffers, buffer);
+ subscriber.next(buffer);
+ closingSubscription.unsubscribe();
+ };
+ closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));
+ }, noop));
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a;
+ try {
+ for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
+ var buffer = buffers_1_1.value;
+ buffer.push(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (buffers_1_1 && !buffers_1_1.done && (_a = buffers_1.return)) _a.call(buffers_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }, function () {
+ while (buffers.length > 0) {
+ subscriber.next(buffers.shift());
+ }
+ subscriber.complete();
+ }));
+ });
+}
+//# sourceMappingURL=bufferToggle.js.map \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage