1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Don't bundle the FakeMLManager class in regular builds

Given that this functionality is only used in the development viewer and in TESTING builds, there's no reason to include this in the regular builds.
This commit is contained in:
Jonas Jenwald 2025-02-27 12:59:58 +01:00
parent 50c573d16d
commit b5ac96da19

View file

@ -53,6 +53,12 @@ class ExternalServices extends BaseExternalServices {
}
class MLManager {
static {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
this.getFakeMLManager = options => new FakeMLManager(options);
}
}
async isEnabledFor(_name) {
return false;
}
@ -68,13 +74,11 @@ class MLManager {
guess(_data) {}
toggleService(_name, _enabled) {}
static getFakeMLManager(options) {
return new FakeMLManager(options);
}
}
class FakeMLManager {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
// eslint-disable-next-line no-var
var FakeMLManager = class {
eventBus = null;
hasProgress = false;
@ -145,6 +149,7 @@ class FakeMLManager {
toggleService(_name, enabled) {
this.enableGuessAltText = enabled;
}
};
}
export { ExternalServices, initCom, MLManager, Preferences };