Guest User

Untitled

a guest
Jan 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. //Create observable from the window event
  2. this._resize$ = Observable.fromEvent(window, 'resize')
  3. .pipe(
  4. debounceTime(200),
  5. map(() => window.innerWidth), //Don't use mapTo!
  6. distinctUntilChanged(),
  7. startWith(window.innerWidth),
  8. tap(width => this.sb.setWindowWidth(width)),
  9. );
  10. this._resize$.subscribe();
Add Comment
Please, Sign In to add comment