Attempt to simplify the signature of the PDFFindBar
constructor, by moving the eventBus
parameter from the options
object
This is similar to the format used by a number of other viewer components, and should simplify the `PDFFindBar` initialization slightly.
This commit is contained in:
parent
25446dbd8d
commit
3f3ddaf541
@ -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,
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user