rxjs-pausable

🚂RxJS pipeable operator to pause and resume streams

MIT License

Stars
4

rxjs-pausable

RxJS pipeable operator to pause and resume streams. See motivation and in-depth explanation in this blog post.

Play with the demo in stackblitz.

Install

npm i rxjs-pausable

Usage

import { PausableObservable, pausable } from 'rxjs-pausable';
import { interval, Subject } from 'rxjs';

const source = new Subject();
const pausable = source.pipe(pausable()).subscribe(console.log);

source.next(1);
source.next(2);
pausable.pause();
source.next(3);
source.next(4);
pausable.resume();
source.next(5);
source.next(6);
source.complete();

// Output: 1, 2, 5, 6
Related Projects