mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Use more optional chaining in the code-base
This patch updates a bunch of older code, that makes conditional function calls, to use optional chaining rather than `if`-blocks. These mostly mechanical changes reduce the size of the `gulp mozcentral` build by a little over 1 kB.
This commit is contained in:
parent
9578152ae4
commit
38ee28b1d3
15 changed files with 51 additions and 119 deletions
|
@ -231,10 +231,7 @@ class PDFThumbnailViewer {
|
|||
// Set the first `pdfPage` immediately, since it's already loaded,
|
||||
// rather than having to repeat the `PDFDocumentProxy.getPage` call in
|
||||
// the `this.#ensurePdfPageLoaded` method before rendering can start.
|
||||
const firstThumbnailView = this._thumbnails[0];
|
||||
if (firstThumbnailView) {
|
||||
firstThumbnailView.setPdfPage(firstPdfPage);
|
||||
}
|
||||
this._thumbnails[0]?.setPdfPage(firstPdfPage);
|
||||
|
||||
// Ensure that the current thumbnail is always highlighted on load.
|
||||
const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue