rxjs-pausable
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

rxjs-pausable

A RxJS pipable operator to pause and resume streams. See motivation and in-depth explanation of the source 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

Package Sidebar

Install

npm i rxjs-pausable

Weekly Downloads

280

Version

1.0.0

License

MIT

Unpacked Size

14.9 kB

Total Files

9

Last publish

Collaborators

  • caroso1222