зеркало из https://github.com/electron/pdf-viewer.git
remove loadCallback in favor of the pdf-loaded event
This commit is contained in:
Родитель
1e10c09c82
Коммит
f25bb4ab69
15
pdf.js
15
pdf.js
|
@ -265,17 +265,6 @@ function PDFViewer(browserApi) {
|
|||
}
|
||||
|
||||
PDFViewer.prototype = {
|
||||
/**
|
||||
* Sets the callback which will be run when the PDF document has finished
|
||||
* loading. If the document is already loaded, it will be run immediately.
|
||||
* @param {Function} callback the callback to be called.
|
||||
*/
|
||||
setLoadCallback: function(callback) {
|
||||
this.loadCallback_ = callback;
|
||||
if (this.loadState_ != LoadState.LOADING && this.loadCallback_)
|
||||
this.loadCallback_(this.loadState_ == LoadState.SUCCESS);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Handle key events. These may come from the user directly or via the
|
||||
|
@ -516,9 +505,7 @@ PDFViewer.prototype = {
|
|||
sendDocumentLoadedMessage_: function() {
|
||||
if (this.loadState_ == LoadState.LOADING)
|
||||
return;
|
||||
if (this.loadCallback_)
|
||||
this.loadCallback_(this.loadState_ == LoadState.SUCCESS);
|
||||
window.dispatchEvent(new Event('pdf-loaded'))
|
||||
window.dispatchEvent(new Event('pdf-loaded', this.loadState_))
|
||||
this.sendScriptingMessage_({
|
||||
type: 'documentLoaded',
|
||||
load_state: this.loadState_
|
||||
|
|
Загрузка…
Ссылка в новой задаче