mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Re-name and re-factor the PDFLinkService.navigateTo
method
This modernizes and improves the code, by using `async`/`await` and by extracting the helper function to its own method. To hopefully avoid confusion, given the next patch, the method is also re-named to `goToDestination` to make is slightly clearer what it actually does.
This commit is contained in:
parent
4b4ac8a13d
commit
8431cfe482
5 changed files with 94 additions and 84 deletions
|
@ -647,7 +647,7 @@ class PDFHistory {
|
|||
this.linkService.rotation = destination.rotation;
|
||||
}
|
||||
if (destination.dest) {
|
||||
this.linkService.navigateTo(destination.dest);
|
||||
this.linkService.goToDestination(destination.dest);
|
||||
} else if (destination.hash) {
|
||||
this.linkService.setHash(destination.hash);
|
||||
} else if (destination.page) {
|
||||
|
@ -655,7 +655,7 @@ class PDFHistory {
|
|||
this.linkService.page = destination.page;
|
||||
}
|
||||
|
||||
// Since `PDFLinkService.navigateTo` is asynchronous, we thus defer the
|
||||
// Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the
|
||||
// resetting of `this._popStateInProgress` slightly.
|
||||
Promise.resolve().then(() => {
|
||||
this._popStateInProgress = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue