[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

@ -21,12 +21,7 @@ import {
DefaultTextLayerFactory,
TextLayerBuilder,
} from "./text_layer_builder.js";
import {
EventBus,
getGlobalEventBus,
NullL10n,
ProgressBar,
} from "./ui_utils.js";
import { EventBus, NullL10n, ProgressBar } from "./ui_utils.js";
import { PDFLinkService, SimpleLinkService } from "./pdf_link_service.js";
import { DownloadManager } from "./download_manager.js";
import { GenericL10n } from "./genericl10n.js";
@ -41,9 +36,6 @@ const pdfjsVersion = PDFJSDev.eval("BUNDLE_VERSION");
// eslint-disable-next-line no-unused-vars
const pdfjsBuild = PDFJSDev.eval("BUNDLE_BUILD");
// For backwards compatibility, ensure that events are re-dispatched to the DOM.
getGlobalEventBus(/* dispatchToDOM = */ true);
export {
PDFViewer,
PDFSinglePageViewer,