Created
October 13, 2020 17:04
-
-
Save LironHazan/044b126dec1760e2f60be98df647126c to your computer and use it in GitHub Desktop.
Doron Sever's snippet for rxjs post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private myStream = new Subject(); | |
private myStream$ = this.myStream.asObservable(); | |
ngOnInit() { | |
// Will only fire after 100 ms. | |
this.myStream$ | |
.pipe(auditTime(100)) | |
.subscribe(e => console.log('will only fire after 100 miliseconds'); | |
this.myStream.next(); // Fire it once | |
setTimeout(() => {this.myStream.next();}, 10); // Fire it twice | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment