Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Subject} from "rxjs/Subject";
- import 'rxjs/add/operator/debounceTime';
- const sub: Subject<number> = new Subject<number>();
- sub.debounceTime(1000).subscribe((value: number) => {
- console.log('subscribe');
- console.log(value);
- });
- sub.next(1);
- sub.next(2);
- sub.next(3);
- setTimeout(() => {
- console.log('firsttimer');
- sub.next(4);
- }, 1100);
- sub.next(5);
- setTimeout(() => {
- console.log('secondtimer');
- sub.next(7);
- }, 2200);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement