mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[api-minor] Deprecate getGlobalEventBus
and update the "viewer components" examples accordingly
To avoid outright breaking third-party usages of the "viewer components" the `getGlobalEventBus` functionality is left intact, but a deprecation message is printed if the function is invoked. The various examples are updated to *explicitly* initialize an `EventBus` instance, and provide that when initializing the relevant viewer components.
This commit is contained in:
parent
965ebe63fd
commit
9a437a158f
16 changed files with 68 additions and 34 deletions
|
@ -25,7 +25,7 @@ const MATCHES_COUNT_LIMIT = 1000;
|
|||
* is done by PDFFindController.
|
||||
*/
|
||||
class PDFFindBar {
|
||||
constructor(options, eventBus = getGlobalEventBus(), l10n = NullL10n) {
|
||||
constructor(options, eventBus, 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 = eventBus;
|
||||
this.eventBus = eventBus || getGlobalEventBus();
|
||||
this.l10n = l10n;
|
||||
|
||||
// Add event listeners to the DOM elements.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue