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
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import { BaseTreeViewer } from "./base_tree_viewer.js";
|
||||
import { createPromiseCapability } from "pdfjs-lib";
|
||||
import { PromiseCapability } from "pdfjs-lib";
|
||||
import { SidebarView } from "./ui_utils.js";
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,7 @@ class PDFOutlineViewer extends BaseTreeViewer {
|
|||
* @private
|
||||
*/
|
||||
_dispatchEvent(outlineCount) {
|
||||
this._currentOutlineItemCapability = createPromiseCapability();
|
||||
this._currentOutlineItemCapability = new PromiseCapability();
|
||||
if (
|
||||
outlineCount === 0 ||
|
||||
this._pdfDocument?.loadingParams.disableAutoFetch
|
||||
|
@ -308,7 +308,7 @@ class PDFOutlineViewer extends BaseTreeViewer {
|
|||
if (this._pageNumberToDestHashCapability) {
|
||||
return this._pageNumberToDestHashCapability.promise;
|
||||
}
|
||||
this._pageNumberToDestHashCapability = createPromiseCapability();
|
||||
this._pageNumberToDestHashCapability = new PromiseCapability();
|
||||
|
||||
const pageNumberToDestHash = new Map(),
|
||||
pageNumberNesting = new Map();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue