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:
Jonas Jenwald 2022-03-07 17:41:41 +01:00
parent f9c2a8d437
commit 317abd6d07
24 changed files with 117 additions and 122 deletions

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { createPromiseCapability, PasswordResponses } from "pdfjs-lib";
import { PasswordResponses, PromiseCapability } from "pdfjs-lib";
/**
* @typedef {Object} PasswordPromptOptions
@ -69,7 +69,7 @@ class PasswordPrompt {
if (this.#activeCapability) {
await this.#activeCapability.promise;
}
this.#activeCapability = createPromiseCapability();
this.#activeCapability = new PromiseCapability();
try {
await this.overlayManager.open(this.dialog);