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
10
web/app.js
10
web/app.js
@ -305,12 +305,9 @@ const PDFViewerApplication = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const prefs = await this.preferences.getAll();
|
AppOptions.setAll(await this.preferences.getAll());
|
||||||
for (const name in prefs) {
|
|
||||||
AppOptions.set(name, prefs[name]);
|
|
||||||
}
|
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
console.error(`_readPreferences: "${reason.message}".`);
|
console.error(`_readPreferences: "${reason?.message}".`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -385,6 +382,9 @@ const PDFViewerApplication = {
|
|||||||
AppOptions.set("locale", hashParams.locale);
|
AppOptions.set("locale", hashParams.locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (waitOn.length === 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
return Promise.all(waitOn).catch(reason => {
|
return Promise.all(waitOn).catch(reason => {
|
||||||
console.error(`_parseHashParameters: "${reason.message}".`);
|
console.error(`_parseHashParameters: "${reason.message}".`);
|
||||||
});
|
});
|
||||||
|
@ -314,6 +314,12 @@ class AppOptions {
|
|||||||
userOptions[name] = value;
|
userOptions[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setAll(options) {
|
||||||
|
for (const name in options) {
|
||||||
|
userOptions[name] = options[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static remove(name) {
|
static remove(name) {
|
||||||
delete userOptions[name];
|
delete userOptions[name];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user