Paginator: add scroll event

Unlike `relocate`, which is debounced, a scroll event is useful when you
want to do stuff as soon as it scrolls.
This commit is contained in:
John Factotum
2024-09-12 05:30:58 +08:00
parent 3658b19a86
commit 327031aca1
+1
View File
@@ -503,6 +503,7 @@ export class Paginator extends HTMLElement {
this.#footer = this.#root.getElementById('footer') this.#footer = this.#root.getElementById('footer')
this.#observer.observe(this.#container) this.#observer.observe(this.#container)
this.#container.addEventListener('scroll', () => this.dispatchEvent(new Event('scroll')))
this.#container.addEventListener('scroll', debounce(() => { this.#container.addEventListener('scroll', debounce(() => {
if (this.scrolled) { if (this.scrolled) {
if (this.#justAnchored) this.#justAnchored = false if (this.#justAnchored) this.#justAnchored = false