diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-09 09:21:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-09 09:22:35 +0100 |
commit | 2c6bbd97d351d507aec1f6e98ab875aa13a7a2e2 (patch) | |
tree | 3d2e799cc3daa5a47014dfd6b7b4cf34e5f14530 | |
parent | 0647f472bc45d82a34e509434c112326499bbe17 (diff) | |
download | PeerTube-2c6bbd97d351d507aec1f6e98ab875aa13a7a2e2.tar.gz PeerTube-2c6bbd97d351d507aec1f6e98ab875aa13a7a2e2.tar.zst PeerTube-2c6bbd97d351d507aec1f6e98ab875aa13a7a2e2.zip |
Improve infinite scroll
-rw-r--r-- | client/src/app/shared/video/infinite-scroller.directive.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/src/app/shared/video/infinite-scroller.directive.ts b/client/src/app/shared/video/infinite-scroller.directive.ts index ed49a9e81..e0f9f4f83 100644 --- a/client/src/app/shared/video/infinite-scroller.directive.ts +++ b/client/src/app/shared/video/infinite-scroller.directive.ts | |||
@@ -38,12 +38,13 @@ export class InfiniteScrollerDirective implements OnInit { | |||
38 | 38 | ||
39 | initialize () { | 39 | initialize () { |
40 | // Emit the last value | 40 | // Emit the last value |
41 | const throttleOptions = { leading: false, trailing: true } | 41 | const throttleOptions = { leading: true, trailing: true } |
42 | 42 | ||
43 | const scrollObservable = fromEvent(window, 'scroll') | 43 | const scrollObservable = fromEvent(window, 'scroll') |
44 | .startWith(true) | 44 | .startWith(true) |
45 | .throttleTime(200, undefined, throttleOptions) | 45 | .throttleTime(200, undefined, throttleOptions) |
46 | .map(() => ({ current: window.scrollY, maximumScroll: document.body.clientHeight - window.innerHeight })) | 46 | .map(() => ({ current: window.scrollY, maximumScroll: document.body.clientHeight - window.innerHeight })) |
47 | .distinctUntilChanged((o1, o2) => o1.current === o2.current) | ||
47 | .share() | 48 | .share() |
48 | 49 | ||
49 | // Scroll Down | 50 | // Scroll Down |