From ba39566079ce930d58039cca8fc4ddeaecd7f63b Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Mon, 2 Mar 2020 23:34:22 +0100 Subject: [PATCH] Updated Third party viewer usage (markdown) --- Third-party-viewer-usage.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Third-party-viewer-usage.md b/Third-party-viewer-usage.md index 9df161e..3461de5 100644 --- a/Third-party-viewer-usage.md +++ b/Third-party-viewer-usage.md @@ -9,4 +9,7 @@ document.addEventListener("webviewerloaded", function() { // The viewer has now been initialized. }) }); -``` \ No newline at end of file +``` + +### Event bus +The viewer components can dispatch events on an event bus to which other components can listen and act upon. PDF.js dispatches common events on the event bus that the user provides. For custom deployments it is required to provide a manually made event bus instance since pull request [#11631](https://github.com/mozilla/pdf.js/pull/11631). This prevents having to use DOM events for this purpose, making the viewer more stand-alone. Event bus instances have an `on` method to start listening for an event, an `off` method to stop listening for an event and a `dispatch` method to send an event through the event bus for other viewer components. \ No newline at end of file