mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #12636 from Snuffleupagus/AppOptions-setAll
Add an `AppOptions.setAll` method, and use it in `PDFViewerApplication._readPreferences`
This commit is contained in:
commit
d3936ac9d2
2 changed files with 11 additions and 5 deletions
10
web/app.js
10
web/app.js
|
@ -305,12 +305,9 @@ const PDFViewerApplication = {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
const prefs = await this.preferences.getAll();
|
||||
for (const name in prefs) {
|
||||
AppOptions.set(name, prefs[name]);
|
||||
}
|
||||
AppOptions.setAll(await this.preferences.getAll());
|
||||
} catch (reason) {
|
||||
console.error(`_readPreferences: "${reason.message}".`);
|
||||
console.error(`_readPreferences: "${reason?.message}".`);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -385,6 +382,9 @@ const PDFViewerApplication = {
|
|||
AppOptions.set("locale", hashParams.locale);
|
||||
}
|
||||
|
||||
if (waitOn.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return Promise.all(waitOn).catch(reason => {
|
||||
console.error(`_parseHashParameters: "${reason.message}".`);
|
||||
});
|
||||
|
|
|
@ -314,6 +314,12 @@ class AppOptions {
|
|||
userOptions[name] = value;
|
||||
}
|
||||
|
||||
static setAll(options) {
|
||||
for (const name in options) {
|
||||
userOptions[name] = options[name];
|
||||
}
|
||||
}
|
||||
|
||||
static remove(name) {
|
||||
delete userOptions[name];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue