Skip to content

Commit 3a21f03

Browse files
Merge pull request #18495 from Snuffleupagus/AppOptions-setAll-EVENT_DISPATCH
Consistently dispatch events, if needed, when setting AppOptions
2 parents 2efa3e4 + 58c7b5b commit 3a21f03

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

web/app_options.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,7 @@ class AppOptions {
571571
}
572572

573573
static set(name, value) {
574-
const defaultOpt = defaultOptions[name];
575-
576-
if (
577-
!defaultOpt ||
578-
!(
579-
typeof value === typeof defaultOpt.value ||
580-
Type[(typeof value).toUpperCase()] & defaultOpt.type
581-
)
582-
) {
583-
return;
584-
}
585-
userOptions.set(name, value);
574+
this.setAll({ [name]: value });
586575
}
587576

588577
static setAll(options, prefs = false) {
@@ -601,15 +590,16 @@ class AppOptions {
601590
) {
602591
continue;
603592
}
604-
if (prefs) {
605-
const { kind } = defaultOpt;
593+
const { kind } = defaultOpt;
606594

607-
if (!(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)) {
608-
continue;
609-
}
610-
if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {
611-
(events ||= new Map()).set(name, userOpt);
612-
}
595+
if (
596+
prefs &&
597+
!(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)
598+
) {
599+
continue;
600+
}
601+
if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {
602+
(events ||= new Map()).set(name, userOpt);
613603
}
614604
userOptions.set(name, userOpt);
615605
}

0 commit comments

Comments
 (0)