diff --git a/web/app.js b/web/app.js index 8c605a20a..691cd867b 100644 --- a/web/app.js +++ b/web/app.js @@ -286,7 +286,7 @@ let PDFViewerApplication = { this.overlayManager = new OverlayManager(); const dispatchToDOM = AppOptions.get('eventBusDispatchToDOM'); - let eventBus = appConfig.eventBus || getGlobalEventBus(dispatchToDOM); + const eventBus = appConfig.eventBus || getGlobalEventBus(dispatchToDOM); this.eventBus = eventBus; let pdfRenderingQueue = new PDFRenderingQueue(); @@ -349,10 +349,7 @@ let PDFViewerApplication = { }); pdfLinkService.setHistory(this.pdfHistory); - // TODO: improve `PDFFindBar` constructor parameter passing - let findBarConfig = Object.create(appConfig.findBar); - findBarConfig.eventBus = eventBus; - this.findBar = new PDFFindBar(findBarConfig, this.l10n); + this.findBar = new PDFFindBar(appConfig.findBar, eventBus, this.l10n); this.pdfDocumentProperties = new PDFDocumentProperties(appConfig.documentProperties, diff --git a/web/pdf_find_bar.js b/web/pdf_find_bar.js index b1696b5c9..e3becbd67 100644 --- a/web/pdf_find_bar.js +++ b/web/pdf_find_bar.js @@ -13,8 +13,8 @@ * limitations under the License. */ +import { getGlobalEventBus, NullL10n } from './ui_utils'; import { FindState } from './pdf_find_controller'; -import { NullL10n } from './ui_utils'; const MATCHES_COUNT_LIMIT = 1000; @@ -25,7 +25,7 @@ const MATCHES_COUNT_LIMIT = 1000; * is done by PDFFindController. */ class PDFFindBar { - constructor(options, l10n = NullL10n) { + constructor(options, eventBus = getGlobalEventBus(), l10n = NullL10n) { this.opened = false; this.bar = options.bar || null; @@ -38,7 +38,7 @@ class PDFFindBar { this.findResultsCount = options.findResultsCount || null; this.findPreviousButton = options.findPreviousButton || null; this.findNextButton = options.findNextButton || null; - this.eventBus = options.eventBus; + this.eventBus = eventBus; this.l10n = l10n; // Add event listeners to the DOM elements.