remove loadCallback in favor of the pdf-loaded event

This commit is contained in:
Heilig Benedek 2017-06-25 14:39:49 +02:00
Родитель 1e10c09c82
Коммит f25bb4ab69
1 изменённых файлов: 1 добавлений и 14 удалений

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_