[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:
Jonas Jenwald 2020-02-26 17:16:30 +01:00
parent 965ebe63fd
commit 9a437a158f
16 changed files with 68 additions and 34 deletions

View file

@ -67,9 +67,9 @@ class PDFFindController {
/**
* @param {PDFFindControllerOptions} options
*/
constructor({ linkService, eventBus = getGlobalEventBus() }) {
constructor({ linkService, eventBus }) {
this._linkService = linkService;
this._eventBus = eventBus;
this._eventBus = eventBus || getGlobalEventBus();
this._reset();
eventBus.on("findbarclose", this._onFindBarClose.bind(this));