1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Convert PDFDocumentLoadingTask, in src/display/api.js, to an ES6 class

Also deprecates the `then` method, in favour of the `promise` getter.
This commit is contained in:
Jonas Jenwald 2018-11-08 13:40:06 +01:00
parent 5f15dc2023
commit ef8e5fd77c
14 changed files with 82 additions and 68 deletions

View file

@ -358,7 +358,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
let absoluteUrl = new URL(task.file, window.location).href;
try {
pdfjsLib.getDocument({
const loadingTask = pdfjsLib.getDocument({
url: absoluteUrl,
password: task.password,
nativeImageDecoderSupport: task.nativeImageDecoderSupport,
@ -367,7 +367,8 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
disableRange: task.disableRange,
disableAutoFetch: !task.enableAutoFetch,
pdfBug: true,
}).then((doc) => {
});
loadingTask.promise.then((doc) => {
task.pdfDoc = doc;
this._nextPage(task, failure);
}, (err) => {