mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Use more optional chaining in the web/
-folder (PR 12961 follow-up)
I overlooked these cases previously, but there's no reason why optional chaining (and nullish coalescing) cannot be used here as well.
This commit is contained in:
parent
bdde621366
commit
bc13932ac1
2 changed files with 4 additions and 7 deletions
|
@ -53,10 +53,7 @@ class PDFSidebarResizer {
|
|||
* @type {number}
|
||||
*/
|
||||
get outerContainerWidth() {
|
||||
if (!this._outerContainerWidth) {
|
||||
this._outerContainerWidth = this.outerContainer.clientWidth;
|
||||
}
|
||||
return this._outerContainerWidth;
|
||||
return (this._outerContainerWidth ||= this.outerContainer.clientWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +132,7 @@ class PDFSidebarResizer {
|
|||
this.eventBus._on("resize", evt => {
|
||||
// When the *entire* viewer is resized, such that it becomes narrower,
|
||||
// ensure that the sidebar doesn't end up being too wide.
|
||||
if (!evt || evt.source !== window) {
|
||||
if (evt?.source !== window) {
|
||||
return;
|
||||
}
|
||||
// Always reset the cached width when the viewer is resized.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue