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

1.0.0 • Public • Published

rxjs-to-stoppable

Install

  yarn add rxjs-to-stoppable

Usage

const { stream$, start, stop } = makeStoppable$$(interval(400));

setTimeout(() => {
  stop();
}, 1200);

setTimeout(() => {
  start();
}, 3000);

stream$.subscribe(() => {
  // Will only emit in [0-1200] and [3000+]
});

Interactive RxViz demo : https://rxviz.com/v/xOv3BYzJ

API

Input :

  • stream$: RxJS stream (required)
  • startOnSubscribe: boolean (optional, default = true)

Output :

{
  stream$: Observable,
  start: () => void,
  stop: () => void
}

Readme

Keywords

none

Package Sidebar

Install

npm i rxjs-to-stoppable

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

4.7 kB

Total Files

6

Last publish

Collaborators

  • rakannimer