mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Re-factor DefaultExternalServices
into a regular class, without static methods
The `DefaultExternalServices` code, which is used to provide build-specific functionality, is very old. This results in a pattern where we first initialize `PDFViewerApplication.externalServices` and then *override* it for the different builds. By converting `DefaultExternalServices` into a "regular" class, and leveraging import maps, we can directly initialize the correct instance depending on the build.
This commit is contained in:
parent
d1080e785a
commit
5dd25b6e80
9 changed files with 80 additions and 61 deletions
|
@ -271,6 +271,7 @@ function createWebpackConfig(
|
|||
"web-annotation_editor_params": "web/annotation_editor_params.js",
|
||||
"web-com": "",
|
||||
"web-download_manager": "",
|
||||
"web-external_services": "",
|
||||
"web-l10n_utils": "web/stubs.js",
|
||||
"web-pdf_attachment_viewer": "web/pdf_attachment_viewer.js",
|
||||
"web-pdf_cursor_tools": "web/pdf_cursor_tools.js",
|
||||
|
@ -292,6 +293,7 @@ function createWebpackConfig(
|
|||
|
||||
viewerAlias["web-com"] = "web/chromecom.js";
|
||||
viewerAlias["web-download_manager"] = "web/download_manager.js";
|
||||
viewerAlias["web-external_services"] = "web/chromecom.js";
|
||||
viewerAlias["web-preferences"] = "web/chromecom.js";
|
||||
viewerAlias["web-print_service"] = "web/pdf_print_service.js";
|
||||
} else if (bundleDefines.GENERIC) {
|
||||
|
@ -305,6 +307,7 @@ function createWebpackConfig(
|
|||
|
||||
viewerAlias["web-com"] = "web/genericcom.js";
|
||||
viewerAlias["web-download_manager"] = "web/download_manager.js";
|
||||
viewerAlias["web-external_services"] = "web/genericcom.js";
|
||||
viewerAlias["web-l10n_utils"] = "web/l10n_utils.js";
|
||||
viewerAlias["web-preferences"] = "web/genericcom.js";
|
||||
viewerAlias["web-print_service"] = "web/pdf_print_service.js";
|
||||
|
@ -320,6 +323,7 @@ function createWebpackConfig(
|
|||
}
|
||||
viewerAlias["web-com"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-download_manager"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-external_services"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-preferences"] = "web/firefoxcom.js";
|
||||
viewerAlias["web-print_service"] = "web/firefox_print_service.js";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue