[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

@ -13,7 +13,6 @@
* limitations under the License.
*/
import { getGlobalEventBus } from "./ui_utils.js";
import { renderTextLayer } from "pdfjs-lib";
const EXPAND_DIVS_TIMEOUT = 300; // ms
@ -45,7 +44,7 @@ class TextLayerBuilder {
enhanceTextSelection = false,
}) {
this.textLayerDiv = textLayerDiv;
this.eventBus = eventBus || getGlobalEventBus();
this.eventBus = eventBus;
this.textContent = null;
this.textContentItemsStr = [];
this.textContentStream = null;