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
|
@ -32,6 +32,7 @@ var DEFAULT_TITLE = '\u2013';
|
|||
* @typedef {Object} PDFOutlineViewerOptions
|
||||
* @property {HTMLDivElement} container - The viewer element.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -52,6 +53,7 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
|
|||
this.lastToggleIsShow = true;
|
||||
this.container = options.container;
|
||||
this.linkService = options.linkService;
|
||||
this.eventBus = options.eventBus;
|
||||
}
|
||||
|
||||
PDFOutlineViewer.prototype = {
|
||||
|
@ -69,11 +71,10 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
|
|||
* @private
|
||||
*/
|
||||
_dispatchEvent: function PDFOutlineViewer_dispatchEvent(outlineCount) {
|
||||
var event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('outlineloaded', true, true, {
|
||||
this.eventBus.dispatch('outlineloaded', {
|
||||
source: this,
|
||||
outlineCount: outlineCount
|
||||
});
|
||||
this.container.dispatchEvent(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue