2017-04-17 08:55:45 +09:00
|
|
|
/* Copyright 2017 Mozilla Foundation
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-10-19 21:33:37 +09:00
|
|
|
import { AppOptions } from "./app_options.js";
|
2024-01-26 22:31:42 +09:00
|
|
|
import { BaseExternalServices } from "./external_services.js";
|
2020-01-02 20:00:16 +09:00
|
|
|
import { BasePreferences } from "./preferences.js";
|
|
|
|
import { GenericL10n } from "./genericl10n.js";
|
2020-12-08 02:15:24 +09:00
|
|
|
import { GenericScripting } from "./generic_scripting.js";
|
2017-04-17 08:55:45 +09:00
|
|
|
|
|
|
|
if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) {
|
|
|
|
throw new Error(
|
2022-03-12 22:40:18 +09:00
|
|
|
'Module "pdfjs-web/genericcom" shall not be used outside GENERIC build.'
|
2017-04-17 08:55:45 +09:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-02-09 20:01:59 +09:00
|
|
|
function initCom(app) {}
|
2017-04-17 08:55:45 +09:00
|
|
|
|
2024-01-26 20:04:54 +09:00
|
|
|
class Preferences extends BasePreferences {
|
2018-07-30 23:48:16 +09:00
|
|
|
async _writeToStorage(prefObj) {
|
|
|
|
localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));
|
2017-04-17 20:21:11 +09:00
|
|
|
}
|
|
|
|
|
2018-07-30 23:48:16 +09:00
|
|
|
async _readFromStorage(prefObj) {
|
2023-10-31 19:39:04 +09:00
|
|
|
return { prefs: JSON.parse(localStorage.getItem("pdfjs.preferences")) };
|
2017-04-17 20:21:11 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-26 22:31:42 +09:00
|
|
|
class ExternalServices extends BaseExternalServices {
|
|
|
|
async createL10n() {
|
2023-11-13 21:55:01 +09:00
|
|
|
return new GenericL10n(AppOptions.get("locale"));
|
2020-01-15 22:26:47 +09:00
|
|
|
}
|
2020-11-09 22:45:02 +09:00
|
|
|
|
2024-01-26 22:31:42 +09:00
|
|
|
createScripting() {
|
2023-12-09 17:40:07 +09:00
|
|
|
return new GenericScripting(AppOptions.get("sandboxBundleSrc"));
|
2020-11-09 22:45:02 +09:00
|
|
|
}
|
2020-01-15 22:26:47 +09:00
|
|
|
}
|
2017-04-17 08:55:45 +09:00
|
|
|
|
2024-02-20 17:49:20 +09:00
|
|
|
class MLManager {
|
|
|
|
async guess() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { ExternalServices, initCom, MLManager, Preferences };
|