Inline the webViewerOpenFileViaURL
function in webViewerInitialized
Given that `webViewerOpenFileViaURL` only has a single call-site, and also isn't a particularly large/complex function, it doesn't seem necessary for this to be a separate function and hence it's simply inlined instead. Also, changes the "no valid build-target was set"-case to throw unconditionally since the only way that it could ever be hit is if there are bugs in the `gulpfile`-code.
This commit is contained in:
parent
24d5d5d761
commit
7cce41c26d
18
web/app.js
18
web/app.js
@ -2229,15 +2229,6 @@ function webViewerInitialized() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webViewerOpenFileViaURL(file);
|
|
||||||
} catch (reason) {
|
|
||||||
PDFViewerApplication.l10n.get("loading_error").then(msg => {
|
|
||||||
PDFViewerApplication._documentError(msg, reason);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function webViewerOpenFileViaURL(file) {
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
if (file) {
|
if (file) {
|
||||||
PDFViewerApplication.open(file);
|
PDFViewerApplication.open(file);
|
||||||
@ -2248,11 +2239,12 @@ function webViewerOpenFileViaURL(file) {
|
|||||||
PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);
|
PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);
|
||||||
PDFViewerApplication.initPassiveLoading();
|
PDFViewerApplication.initPassiveLoading();
|
||||||
} else {
|
} else {
|
||||||
if (file) {
|
throw new Error("Not implemented: webViewerInitialized");
|
||||||
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
|
||||||
} else {
|
|
||||||
PDFViewerApplication._hideViewBookmark();
|
|
||||||
}
|
}
|
||||||
|
} catch (reason) {
|
||||||
|
PDFViewerApplication.l10n.get("loading_error").then(msg => {
|
||||||
|
PDFViewerApplication._documentError(msg, reason);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user