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
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { binarySearchFirstItem, scrollIntoView } from "./ui_utils.js";
|
||||
import { getCharacterType, getNormalizeWithNFKC } from "./pdf_find_utils.js";
|
||||
import { createPromiseCapability } from "pdfjs-lib";
|
||||
import { PromiseCapability } from "pdfjs-lib";
|
||||
|
||||
const FindState = {
|
||||
FOUND: 0,
|
||||
|
@ -582,7 +582,7 @@ class PDFFindController {
|
|||
clearTimeout(this._findTimeout);
|
||||
this._findTimeout = null;
|
||||
|
||||
this._firstPageCapability = createPromiseCapability();
|
||||
this._firstPageCapability = new PromiseCapability();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -849,7 +849,7 @@ class PDFFindController {
|
|||
let promise = Promise.resolve();
|
||||
const textOptions = { disableNormalization: true };
|
||||
for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
|
||||
const extractTextCapability = createPromiseCapability();
|
||||
const extractTextCapability = new PromiseCapability();
|
||||
this._extractTextPromises[i] = extractTextCapability.promise;
|
||||
|
||||
promise = promise.then(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue