mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #19557 from Snuffleupagus/PDFViewer-cleanupTimeouts
Abort various timeouts, in `PDFViewer`, when closing the document (PR 19128 follow-up)
This commit is contained in:
commit
4a48a7ec0f
1 changed files with 14 additions and 8 deletions
|
@ -1173,6 +1173,7 @@ class PDFViewer {
|
|||
this.#hiddenCopyElement?.remove();
|
||||
this.#hiddenCopyElement = null;
|
||||
|
||||
this.#cleanupTimeouts();
|
||||
this.#cleanupSwitchAnnotationEditorMode();
|
||||
}
|
||||
|
||||
|
@ -2340,6 +2341,17 @@ class PDFViewer {
|
|||
]);
|
||||
}
|
||||
|
||||
#cleanupTimeouts() {
|
||||
if (this.#scaleTimeoutId !== null) {
|
||||
clearTimeout(this.#scaleTimeoutId);
|
||||
this.#scaleTimeoutId = null;
|
||||
}
|
||||
if (this.#scrollTimeoutId !== null) {
|
||||
clearTimeout(this.#scrollTimeoutId);
|
||||
this.#scrollTimeoutId = null;
|
||||
}
|
||||
}
|
||||
|
||||
#cleanupSwitchAnnotationEditorMode() {
|
||||
this.#switchAnnotationEditorModeAC?.abort();
|
||||
this.#switchAnnotationEditorModeAC = null;
|
||||
|
@ -2466,14 +2478,8 @@ class PDFViewer {
|
|||
for (const pageView of this._pages) {
|
||||
pageView.update(updateArgs);
|
||||
}
|
||||
if (this.#scaleTimeoutId !== null) {
|
||||
clearTimeout(this.#scaleTimeoutId);
|
||||
this.#scaleTimeoutId = null;
|
||||
}
|
||||
if (this.#scrollTimeoutId !== null) {
|
||||
clearTimeout(this.#scrollTimeoutId);
|
||||
this.#scrollTimeoutId = null;
|
||||
}
|
||||
this.#cleanupTimeouts();
|
||||
|
||||
if (!noUpdate) {
|
||||
this.update();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue