UNPKG

2.05 kBJavaScriptView Raw
1/**
2 * @licstart The following is the entire license notice for the
3 * JavaScript code in this page
4 *
5 * Copyright 2022 Mozilla Foundation
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * @licend The above is the entire license notice for the
20 * JavaScript code in this page
21 */
22"use strict";
23
24Object.defineProperty(exports, "__esModule", {
25 value: true
26});
27exports.GenericCom = void 0;
28
29var _app = require("./app.js");
30
31var _preferences = require("./preferences.js");
32
33var _download_manager = require("./download_manager.js");
34
35var _genericl10n = require("./genericl10n.js");
36
37var _generic_scripting = require("./generic_scripting.js");
38
39;
40const GenericCom = {};
41exports.GenericCom = GenericCom;
42
43class GenericPreferences extends _preferences.BasePreferences {
44 async _writeToStorage(prefObj) {
45 localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));
46 }
47
48 async _readFromStorage(prefObj) {
49 return JSON.parse(localStorage.getItem("pdfjs.preferences"));
50 }
51
52}
53
54class GenericExternalServices extends _app.DefaultExternalServices {
55 static createDownloadManager(options) {
56 return new _download_manager.DownloadManager();
57 }
58
59 static createPreferences() {
60 return new GenericPreferences();
61 }
62
63 static createL10n({
64 locale = "en-US"
65 }) {
66 return new _genericl10n.GenericL10n(locale);
67 }
68
69 static createScripting({
70 sandboxBundleSrc
71 }) {
72 return new _generic_scripting.GenericScripting(sandboxBundleSrc);
73 }
74
75}
76
77_app.PDFViewerApplication.externalServices = GenericExternalServices;
\No newline at end of file