mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Disconnect the resize observer and remove scroll listener when unbinding window events
This commit is contained in:
parent
fdb3617e0f
commit
4430b6b703
4 changed files with 35 additions and 4 deletions
|
@ -309,7 +309,21 @@ class PDFViewer {
|
|||
this.renderingQueue = options.renderingQueue;
|
||||
}
|
||||
|
||||
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));
|
||||
const { abortSignal } = options;
|
||||
abortSignal?.addEventListener(
|
||||
"abort",
|
||||
() => {
|
||||
this.#resizeObserver.disconnect();
|
||||
this.#resizeObserver = null;
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
this.scroll = watchScroll(
|
||||
this.container,
|
||||
this._scrollUpdate.bind(this),
|
||||
abortSignal
|
||||
);
|
||||
this.presentationModeState = PresentationModeState.UNKNOWN;
|
||||
this._resetView();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue