mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
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:
parent
40f531ee87
commit
1b87b1c384
4 changed files with 108 additions and 78 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue