Use arrow functions in PDFViewerApplication.initPassiveLoading
This code is *very* old and it even predates the existence of arrow functions. Hence we can now reduce the overall verbosity by not having to explicitly spell out `PDFViewerApplication` everywhere.
This commit is contained in:
parent
3787bd41ef
commit
b375a867eb
22
web/app.js
22
web/app.js
@ -702,13 +702,13 @@ const PDFViewerApplication = {
|
|||||||
throw new Error("Not implemented: initPassiveLoading");
|
throw new Error("Not implemented: initPassiveLoading");
|
||||||
}
|
}
|
||||||
this.externalServices.initPassiveLoading({
|
this.externalServices.initPassiveLoading({
|
||||||
onOpenWithTransport(url, length, transport) {
|
onOpenWithTransport: (url, length, transport) => {
|
||||||
PDFViewerApplication.open(url, { length, range: transport });
|
this.open(url, { length, range: transport });
|
||||||
},
|
},
|
||||||
onOpenWithData(data) {
|
onOpenWithData: data => {
|
||||||
PDFViewerApplication.open(data);
|
this.open(data);
|
||||||
},
|
},
|
||||||
onOpenWithURL(url, length, originalUrl) {
|
onOpenWithURL: (url, length, originalUrl) => {
|
||||||
let file = url,
|
let file = url,
|
||||||
args = null;
|
args = null;
|
||||||
if (length !== undefined) {
|
if (length !== undefined) {
|
||||||
@ -717,21 +717,21 @@ const PDFViewerApplication = {
|
|||||||
if (originalUrl !== undefined) {
|
if (originalUrl !== undefined) {
|
||||||
file = { url, originalUrl };
|
file = { url, originalUrl };
|
||||||
}
|
}
|
||||||
PDFViewerApplication.open(file, args);
|
this.open(file, args);
|
||||||
},
|
},
|
||||||
onError(err) {
|
onError: err => {
|
||||||
PDFViewerApplication.l10n
|
this.l10n
|
||||||
.get(
|
.get(
|
||||||
"loading_error",
|
"loading_error",
|
||||||
null,
|
null,
|
||||||
"An error occurred while loading the PDF."
|
"An error occurred while loading the PDF."
|
||||||
)
|
)
|
||||||
.then(msg => {
|
.then(msg => {
|
||||||
PDFViewerApplication._documentError(msg, err);
|
this._documentError(msg, err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onProgress(loaded, total) {
|
onProgress: (loaded, total) => {
|
||||||
PDFViewerApplication.progress(loaded / total);
|
this.progress(loaded / total);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user