Improved editor logs
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import Diff from "./Diff"
|
||||
|
||||
export default class InfiniteScroller {
|
||||
container: HTMLElement
|
||||
threshold: number
|
||||
@ -6,10 +8,21 @@ export default class InfiniteScroller {
|
||||
this.container = container
|
||||
this.threshold = threshold
|
||||
|
||||
this.container.addEventListener("scroll", e => {
|
||||
let check = () => {
|
||||
if(this.container.scrollTop + this.container.clientHeight >= this.container.scrollHeight - threshold) {
|
||||
this.loadMore()
|
||||
}
|
||||
}
|
||||
|
||||
this.container.addEventListener("scroll", e => {
|
||||
// Wait for mutations to finish before checking if we need infinite scroll to trigger.
|
||||
if(Diff.mutations.mutations.length > 0) {
|
||||
Diff.mutations.wait(() => check())
|
||||
return
|
||||
}
|
||||
|
||||
// Otherwise, check immediately.
|
||||
check()
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user