1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +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:
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

@ -23,6 +23,8 @@ var DEFAULT_SCALE = 1.0;
var container = document.getElementById("pageContainer");
var eventBus = new pdfjsViewer.EventBus();
// Fetch the PDF document from the URL using promises.
var loadingTask = pdfjsLib.getDocument(DEFAULT_URL);
loadingTask.promise.then(function(doc) {
@ -39,6 +41,7 @@ loadingTask.promise.then(function(doc) {
id: pageNum,
scale: DEFAULT_SCALE,
defaultViewport: pdfPage.getViewport({ scale: DEFAULT_SCALE }),
eventBus: eventBus,
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
renderInteractiveForms: true,
});