[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,9 +13,9 @@
* limitations under the License.
*/
import { getGlobalEventBus, scrollIntoView } from "./ui_utils.js";
import { createPromiseCapability } from "pdfjs-lib";
import { getCharacterType } from "./pdf_find_utils.js";
import { scrollIntoView } from "./ui_utils.js";
const FindState = {
FOUND: 0,
@ -69,7 +69,7 @@ class PDFFindController {
*/
constructor({ linkService, eventBus }) {
this._linkService = linkService;
this._eventBus = eventBus || getGlobalEventBus();
this._eventBus = eventBus;
this._reset();
eventBus._on("findbarclose", this._onFindBarClose.bind(this));