Rename function

This commit is contained in:
Jonatan Heyman 2023-12-27 01:03:54 +01:00
parent eaccfd35da
commit d02075f343

View File

@ -34,7 +34,7 @@
this.theme = mode.computed this.theme = mode.computed
this.systemTheme = mode.theme this.systemTheme = mode.theme
}) })
const onChangeCallback = (theme) => { const onThemeChange = (theme) => {
this.theme = theme this.theme = theme
if (theme === "system") { if (theme === "system") {
document.body.setAttribute("theme", window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") document.body.setAttribute("theme", window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
@ -42,8 +42,8 @@
document.body.setAttribute("theme", theme) document.body.setAttribute("theme", theme)
} }
} }
onChangeCallback(window.heynote.themeMode.initial) onThemeChange(window.heynote.themeMode.initial)
window.heynote.themeMode.onChange(onChangeCallback) window.heynote.themeMode.onChange(onThemeChange)
window.heynote.onSettingsChange((settings) => { window.heynote.onSettingsChange((settings) => {
this.settings = settings this.settings = settings
}) })