mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Adds EventBus.
This commit is contained in:
parent
55581b162e
commit
7fd3db9977
17 changed files with 510 additions and 151 deletions
|
@ -35,6 +35,7 @@ var CONTROLS_SELECTOR = 'pdfPresentationModeControls';
|
|||
* @property {HTMLDivElement} container - The container for the viewer element.
|
||||
* @property {HTMLDivElement} viewer - (optional) The viewer element.
|
||||
* @property {PDFViewer} pdfViewer - The document viewer.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {Array} contextMenuItems - (optional) The menuitems that are added
|
||||
* to the context menu in Presentation Mode.
|
||||
*/
|
||||
|
@ -51,6 +52,7 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
|
|||
this.container = options.container;
|
||||
this.viewer = options.viewer || options.container.firstElementChild;
|
||||
this.pdfViewer = options.pdfViewer;
|
||||
this.eventBus = options.eventBus;
|
||||
var contextMenuItems = options.contextMenuItems || null;
|
||||
|
||||
this.active = false;
|
||||
|
@ -163,12 +165,11 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
|
|||
* @private
|
||||
*/
|
||||
_notifyStateChange: function PDFPresentationMode_notifyStateChange() {
|
||||
var event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('presentationmodechanged', true, true, {
|
||||
this.eventBus.dispatch('presentationmodechanged', {
|
||||
source: this,
|
||||
active: this.active,
|
||||
switchInProgress: !!this.switchInProgress
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue