Disconnect the resize observer and remove scroll listener when unbinding window events

This commit is contained in:
Calixte Denizet 2024-05-30 18:53:07 +02:00
parent fdb3617e0f
commit 4430b6b703
4 changed files with 35 additions and 4 deletions

View file

@ -42,6 +42,8 @@ const THUMBNAIL_SELECTED_CLASS = "selected";
* @property {Object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
* events.
*/
/**
@ -57,6 +59,7 @@ class PDFThumbnailViewer {
linkService,
renderingQueue,
pageColors,
abortSignal,
}) {
this.container = container;
this.eventBus = eventBus;
@ -64,7 +67,11 @@ class PDFThumbnailViewer {
this.renderingQueue = renderingQueue;
this.pageColors = pageColors || null;
this.scroll = watchScroll(this.container, this.#scrollUpdated.bind(this));
this.scroll = watchScroll(
this.container,
this.#scrollUpdated.bind(this),
abortSignal
);
this.#resetView();
}