Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create observable from the window event
- this._resize$ = Observable.fromEvent(window, 'resize')
- .pipe(
- debounceTime(200),
- map(() => window.innerWidth), //Don't use mapTo!
- distinctUntilChanged(),
- startWith(window.innerWidth),
- tap(width => this.sb.setWindowWidth(width)),
- );
- this._resize$.subscribe();
Add Comment
Please, Sign In to add comment