Improve infinite scroll
This commit is contained in:
parent
0647f472bc
commit
2c6bbd97d3
1 changed files with 2 additions and 1 deletions
|
@ -38,12 +38,13 @@ export class InfiniteScrollerDirective implements OnInit {
|
|||
|
||||
initialize () {
|
||||
// Emit the last value
|
||||
const throttleOptions = { leading: false, trailing: true }
|
||||
const throttleOptions = { leading: true, trailing: true }
|
||||
|
||||
const scrollObservable = fromEvent(window, 'scroll')
|
||||
.startWith(true)
|
||||
.throttleTime(200, undefined, throttleOptions)
|
||||
.map(() => ({ current: window.scrollY, maximumScroll: document.body.clientHeight - window.innerHeight }))
|
||||
.distinctUntilChanged((o1, o2) => o1.current === o2.current)
|
||||
.share()
|
||||
|
||||
// Scroll Down
|
||||
|
|
Loading…
Reference in a new issue