Add a timeout before sending the pdf doc to the worker such that there is no too-long-js-running hint
This commit is contained in:
parent
20a348fc0c
commit
d313115d19
11
pdf.js
11
pdf.js
@ -4224,7 +4224,11 @@ var PDFDoc = (function() {
|
||||
WorkerProcessorHandler.setup(processorHandler);
|
||||
}
|
||||
|
||||
processorHandler.send('doc', this.data);
|
||||
this.workerReadyPromise = new Promise('workerReady');
|
||||
setTimeout(function() {
|
||||
processorHandler.send('doc', this.data);
|
||||
this.workerReadyPromise.resolve(true);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
constructor.prototype = {
|
||||
@ -4233,7 +4237,10 @@ var PDFDoc = (function() {
|
||||
},
|
||||
|
||||
startRendering: function(page) {
|
||||
this.processorHandler.send('page_request', page.page.pageNumber + 1);
|
||||
// The worker might not be ready to receive the page request yet.
|
||||
this.workerReadyPromise.then(function() {
|
||||
this.processorHandler.send('page_request', page.page.pageNumber + 1);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
getPage: function(n) {
|
||||
|
Loading…
Reference in New Issue
Block a user