Break import cycles, in the viewer, for PDFViewerApplication

Currently the `web/app.js` file pulls in various build-specific dependencies, via the use of import maps, and those files in turn import from `web/app.js` thus creating undesirable import cycles.
To avoid this we instead pass in a `PDFViewerApplication`-reference, immediately after it's been created, to the relevant code.

Note that we use an ESLint plugin rule, see `import/no-cycle`, that is normally able to catch import cycles. However, in this case import maps are involved which is why this wasn't caught.
This commit is contained in:
Jonas Jenwald 2024-02-09 12:01:59 +01:00
parent 6da9448f6c
commit e98b9b019a
6 changed files with 49 additions and 34 deletions

View file

@ -25,7 +25,7 @@ if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) {
);
}
const GenericCom = {};
function initCom(app) {}
class Preferences extends BasePreferences {
async _writeToStorage(prefObj) {
@ -47,4 +47,4 @@ class ExternalServices extends BaseExternalServices {
}
}
export { ExternalServices, GenericCom, Preferences };
export { ExternalServices, initCom, Preferences };