Merge pull request #19568 from Snuffleupagus/FakeMLManager-no-bundle

Don't bundle the `FakeMLManager` class in regular builds
This commit is contained in:
Tim van der Meij 2025-03-02 15:30:03 +01:00 committed by GitHub
commit 27c82ab8cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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