mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-01-31 11:02:07 +08:00
using optionals to avoid exceptions
This commit is contained in:
parent
b6cbabcaa5
commit
ccd61c5b20
3 changed files with 7 additions and 7 deletions
|
@ -123,7 +123,7 @@ function handleSpace() {
|
|||
.toString()
|
||||
.toUpperCase()
|
||||
);
|
||||
Settings.groups.layout.updateButton();
|
||||
Settings.groups.layout?.updateButton();
|
||||
}
|
||||
dontInsertSpace = true;
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ list.applyCustomFont = new SimplePopup(
|
|||
"Apply",
|
||||
(fontName) => {
|
||||
if (fontName === "") return;
|
||||
Settings.groups.fontFamily.setValue(fontName.replace(/\s/g, "_"));
|
||||
Settings.groups.fontFamily?.setValue(fontName.replace(/\s/g, "_"));
|
||||
},
|
||||
() => {}
|
||||
);
|
||||
|
|
|
@ -154,7 +154,7 @@ export async function activate(funbox) {
|
|||
UpdateConfig.setKeymapMode
|
||||
);
|
||||
UpdateConfig.setKeymapMode("next", true);
|
||||
Settings.groups.keymapMode.updateButton();
|
||||
Settings.groups.keymapMode?.updateButton();
|
||||
TestLogic.restart(undefined, true);
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ export async function activate(funbox) {
|
|||
);
|
||||
UpdateConfig.setKeymapMode("off", true);
|
||||
UpdateConfig.setHighlightMode("letter", true);
|
||||
Settings.groups.keymapMode.updateButton();
|
||||
Settings.groups.keymapMode?.updateButton();
|
||||
TestLogic.restart(undefined, true);
|
||||
} else if (funbox === "layoutfluid") {
|
||||
rememberSetting(
|
||||
|
@ -190,7 +190,7 @@ export async function activate(funbox) {
|
|||
UpdateConfig.setKeymapMode
|
||||
);
|
||||
// UpdateConfig.setKeymapMode("next");
|
||||
Settings.groups.keymapMode.updateButton();
|
||||
Settings.groups.keymapMode?.updateButton();
|
||||
// UpdateConfig.setSavedLayout(Config.layout);
|
||||
rememberSetting("layout", Config.layout, UpdateConfig.setLayout);
|
||||
UpdateConfig.setLayout(
|
||||
|
@ -199,7 +199,7 @@ export async function activate(funbox) {
|
|||
: "qwerty",
|
||||
true
|
||||
);
|
||||
Settings.groups.layout.updateButton();
|
||||
Settings.groups.layout?.updateButton();
|
||||
rememberSetting(
|
||||
"keymapLayout",
|
||||
Config.keymapLayout,
|
||||
|
@ -211,7 +211,7 @@ export async function activate(funbox) {
|
|||
: "qwerty",
|
||||
true
|
||||
);
|
||||
Settings.groups.keymapLayout.updateButton();
|
||||
Settings.groups.keymapLayout?.updateButton();
|
||||
TestLogic.restart(undefined, true);
|
||||
} else if (funbox === "memory") {
|
||||
rememberSetting("mode", Config.mode, UpdateConfig.setMode);
|
||||
|
|
Loading…
Reference in a new issue