Skip to content

Instantly share code, notes, and snippets.

@caroso1222
Last active November 29, 2018 05:08
Show Gist options
  • Save caroso1222/909e8440db40de9617f2e4341645b0b6 to your computer and use it in GitHub Desktop.
Save caroso1222/909e8440db40de9617f2e4341645b0b6 to your computer and use it in GitHub Desktop.
rxjs-pausify-example
// THIS PACKAGE DOES NOT EXIST! IT'S ONLY FOR THE DEMO!
import { PauseableObservable, pausify } from 'rxjs-pausify';
export class MyClass {
pausable$: PauseableObservable<number>;
constructor() {
this.pausable$ = pausify(interval(500));
this.pausable$.subscribe(console.log);
}
pause() {
this.pausable$.pause();
}
resume() {
this.pausable$.resume();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment