Add source
parameters to all remaining EventBus.dispatch
calls that are currently missing those
This is necessary for subsequent patches, and will help avoid unnecessary event re-dispatching in cases where the event source is `window`.
This commit is contained in:
parent
283f2dfcc3
commit
486c843215
@ -160,7 +160,7 @@ let PDFViewerApplication = {
|
||||
this.l10n.translate(appContainer).then(() => {
|
||||
// Dispatch the 'localized' event on the `eventBus` once the viewer
|
||||
// has been fully initialized and translated.
|
||||
this.eventBus.dispatch('localized');
|
||||
this.eventBus.dispatch('localized', { source: this, });
|
||||
});
|
||||
|
||||
this.initialized = true;
|
||||
@ -1371,14 +1371,15 @@ let PDFViewerApplication = {
|
||||
};
|
||||
_boundEvents.windowHashChange = () => {
|
||||
eventBus.dispatch('hashchange', {
|
||||
source: window,
|
||||
hash: document.location.hash.substring(1),
|
||||
});
|
||||
};
|
||||
_boundEvents.windowBeforePrint = () => {
|
||||
eventBus.dispatch('beforeprint');
|
||||
eventBus.dispatch('beforeprint', { source: window, });
|
||||
};
|
||||
_boundEvents.windowAfterPrint = () => {
|
||||
eventBus.dispatch('afterprint');
|
||||
eventBus.dispatch('afterprint', { source: window, });
|
||||
};
|
||||
|
||||
window.addEventListener('wheel', webViewerWheel);
|
||||
@ -1560,6 +1561,7 @@ function webViewerInitialized() {
|
||||
return;
|
||||
}
|
||||
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
||||
source: this,
|
||||
fileInput: evt.target,
|
||||
});
|
||||
});
|
||||
@ -1578,6 +1580,7 @@ function webViewerInitialized() {
|
||||
return;
|
||||
}
|
||||
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
||||
source: this,
|
||||
fileInput: evt.dataTransfer,
|
||||
});
|
||||
});
|
||||
|
@ -60,19 +60,19 @@ class PDFPresentationMode {
|
||||
if (contextMenuItems) {
|
||||
contextMenuItems.contextFirstPage.addEventListener('click', () => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('firstpage');
|
||||
this.eventBus.dispatch('firstpage', { source: this, });
|
||||
});
|
||||
contextMenuItems.contextLastPage.addEventListener('click', () => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('lastpage');
|
||||
this.eventBus.dispatch('lastpage', { source: this, });
|
||||
});
|
||||
contextMenuItems.contextPageRotateCw.addEventListener('click', () => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('rotatecw');
|
||||
this.eventBus.dispatch('rotatecw', { source: this, });
|
||||
});
|
||||
contextMenuItems.contextPageRotateCcw.addEventListener('click', () => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('rotateccw');
|
||||
this.eventBus.dispatch('rotateccw', { source: this, });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -100,19 +100,19 @@ class Toolbar {
|
||||
let self = this;
|
||||
|
||||
items.previous.addEventListener('click', function() {
|
||||
eventBus.dispatch('previouspage');
|
||||
eventBus.dispatch('previouspage', { source: self, });
|
||||
});
|
||||
|
||||
items.next.addEventListener('click', function() {
|
||||
eventBus.dispatch('nextpage');
|
||||
eventBus.dispatch('nextpage', { source: self, });
|
||||
});
|
||||
|
||||
items.zoomIn.addEventListener('click', function() {
|
||||
eventBus.dispatch('zoomin');
|
||||
eventBus.dispatch('zoomin', { source: self, });
|
||||
});
|
||||
|
||||
items.zoomOut.addEventListener('click', function() {
|
||||
eventBus.dispatch('zoomout');
|
||||
eventBus.dispatch('zoomout', { source: self, });
|
||||
});
|
||||
|
||||
items.pageNumber.addEventListener('click', function() {
|
||||
@ -137,19 +137,19 @@ class Toolbar {
|
||||
});
|
||||
|
||||
items.presentationModeButton.addEventListener('click', function() {
|
||||
eventBus.dispatch('presentationmode');
|
||||
eventBus.dispatch('presentationmode', { source: self, });
|
||||
});
|
||||
|
||||
items.openFile.addEventListener('click', function() {
|
||||
eventBus.dispatch('openfile');
|
||||
eventBus.dispatch('openfile', { source: self, });
|
||||
});
|
||||
|
||||
items.print.addEventListener('click', function() {
|
||||
eventBus.dispatch('print');
|
||||
eventBus.dispatch('print', { source: self, });
|
||||
});
|
||||
|
||||
items.download.addEventListener('click', function() {
|
||||
eventBus.dispatch('download');
|
||||
eventBus.dispatch('download', { source: self, });
|
||||
});
|
||||
|
||||
// Suppress context menus for some controls.
|
||||
|
Loading…
Reference in New Issue
Block a user