mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Change the createPromiseCapability
helper function into a PromiseCapability
class
This is not only slightly more compact, but it also simplifies the handling of the `settled` getter.
This commit is contained in:
parent
f9c2a8d437
commit
317abd6d07
24 changed files with 117 additions and 122 deletions
|
@ -16,7 +16,7 @@
|
|||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
|
||||
import { apiPageLayoutToViewerModes, RenderingStates } from "./ui_utils.js";
|
||||
import { createPromiseCapability, shadow } from "pdfjs-lib";
|
||||
import { PromiseCapability, shadow } from "pdfjs-lib";
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFScriptingManagerOptions
|
||||
|
@ -357,7 +357,7 @@ class PDFScriptingManager {
|
|||
visitedPages = this._visitedPages;
|
||||
|
||||
if (initialize) {
|
||||
this._closeCapability = createPromiseCapability();
|
||||
this._closeCapability = new PromiseCapability();
|
||||
}
|
||||
if (!this._closeCapability) {
|
||||
return; // Scripting isn't fully initialized yet.
|
||||
|
@ -443,7 +443,7 @@ class PDFScriptingManager {
|
|||
* @private
|
||||
*/
|
||||
_createScripting() {
|
||||
this._destroyCapability = createPromiseCapability();
|
||||
this._destroyCapability = new PromiseCapability();
|
||||
|
||||
if (this._scripting) {
|
||||
throw new Error("_createScripting: Scripting already exists.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue