Debian Codegraph @

node/rxjs/dist/esm/internal/operators/buffer.js

raw
1 import { operate } from '../util/lift';
2 import { noop } from '../util/noop';
3 import { createOperatorSubscriber } from './OperatorSubscriber';
4 import { innerFrom } from '../observable/innerFrom';
5 export function buffer(closingNotifier) {
6 return operate((source, subscriber) => {
7 let currentBuffer = [];
8 source.subscribe(createOperatorSubscriber(subscriber, (value) => currentBuffer.push(value), () => {
9 subscriber.next(currentBuffer);
10 subscriber.complete();
11 }));
12 innerFrom(closingNotifier).subscribe(createOperatorSubscriber(subscriber, () => {
13 const b = currentBuffer;
14 currentBuffer = [];
15 subscriber.next(b);
16 }, noop));
17 return () => {
18 currentBuffer = null;
19 };
20 });
21 }
22 //# sourceMappingURL=buffer.js.map