[api-minor] Remove the getGlobalEventBus viewer functionality (PR 11631 follow-up)

The correct/intended way of working with the "viewer components" is by providing an `EventBus` instance upon initialization, and the `getGlobalEventBus` was only added for backwards compatibility.
Note, for example, that using `getGlobalEventBus` doesn't really work at all well with a use-case where there's *multiple* `PDFViewer` instances on a one page, since it may then be difficult/impossible to tell which viewer a particular event originated from.

All of the "viewer components" examples have been previously updated, such that there's no longer any code/examples which relies on the now removed `getGlobalEventBus` functionality.
This commit is contained in:
Jonas Jenwald 2020-02-27 15:02:03 +01:00
parent c12ea21c14
commit 7fd5f2dd61
8 changed files with 10 additions and 26 deletions

View file

@ -884,17 +884,6 @@ class EventBus {
}
}
let globalEventBus = null;
function getGlobalEventBus(dispatchToDOM = false) {
console.error(
"getGlobalEventBus is deprecated, use a manually created EventBus instance instead."
);
if (!globalEventBus) {
globalEventBus = new EventBus({ dispatchToDOM });
}
return globalEventBus;
}
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
@ -1013,7 +1002,6 @@ export {
SpreadMode,
NullL10n,
EventBus,
getGlobalEventBus,
clamp,
ProgressBar,
getPDFFileNameFromURL,