Re-factor the various ExternalServices, used in the default viewer, to classes with static methods

This seems nicer overall, since it's now a bit clearer that the various build targets *extend* the default implementation.
This commit is contained in:
Jonas Jenwald 2020-01-15 14:26:47 +01:00
parent 40f531ee87
commit 1b87b1c384
4 changed files with 108 additions and 78 deletions

View file

@ -37,16 +37,19 @@ class GenericPreferences extends BasePreferences {
}
}
const GenericExternalServices = Object.create(DefaultExternalServices);
GenericExternalServices.createDownloadManager = function(options) {
return new DownloadManager(options);
};
GenericExternalServices.createPreferences = function() {
return new GenericPreferences();
};
GenericExternalServices.createL10n = function({ locale = "en-US" }) {
return new GenericL10n(locale);
};
class GenericExternalServices extends DefaultExternalServices {
static createDownloadManager(options) {
return new DownloadManager(options);
}
static createPreferences() {
return new GenericPreferences();
}
static createL10n({ locale = "en-US" }) {
return new GenericL10n(locale);
}
}
PDFViewerApplication.externalServices = GenericExternalServices;
export { GenericCom };