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,8 +13,8 @@
* limitations under the License.
*/
import { createPromiseCapability, PDFDateString } from "pdfjs-lib";
import { getPageSizeInches, isPortraitOrientation } from "./ui_utils.js";
import { PDFDateString, PromiseCapability } from "pdfjs-lib";
const DEFAULT_FIELD_CONTENT = "-";
@ -201,7 +201,7 @@ class PDFDocumentProperties {
this.pdfDocument = null;
this.#fieldData = null;
this._dataAvailableCapability = createPromiseCapability();
this._dataAvailableCapability = new PromiseCapability();
this._currentPageNumber = 1;
this._pagesRotation = 0;
}