Move cancelling of idleCallbacks from PDFViewerApplication.close
and into its own helper method
Since the `close` method has become quite large, this small re-factoring shouldn't hurt.
This commit is contained in:
parent
7ce6634c51
commit
8d72981c18
19
web/app.js
19
web/app.js
@ -763,6 +763,19 @@ const PDFViewerApplication = {
|
|||||||
document.title = title;
|
document.title = title;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_cancelIdleCallbacks() {
|
||||||
|
if (!this._idleCallbacks.size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const callback of this._idleCallbacks) {
|
||||||
|
window.cancelIdleCallback(callback);
|
||||||
|
}
|
||||||
|
this._idleCallbacks.clear();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes opened PDF document.
|
* Closes opened PDF document.
|
||||||
* @returns {Promise} - Returns the promise, which is resolved when all
|
* @returns {Promise} - Returns the promise, which is resolved when all
|
||||||
@ -799,10 +812,8 @@ const PDFViewerApplication = {
|
|||||||
this._contentLength = null;
|
this._contentLength = null;
|
||||||
this.triggerDelayedFallback = null;
|
this.triggerDelayedFallback = null;
|
||||||
this._saveInProgress = false;
|
this._saveInProgress = false;
|
||||||
for (const callback of this._idleCallbacks) {
|
|
||||||
window.cancelIdleCallback(callback);
|
this._cancelIdleCallbacks();
|
||||||
}
|
|
||||||
this._idleCallbacks.clear();
|
|
||||||
|
|
||||||
if (this._scriptingInstance) {
|
if (this._scriptingInstance) {
|
||||||
const { scripting, events } = this._scriptingInstance;
|
const { scripting, events } = this._scriptingInstance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user