mirror of
https://github.com/fmhy/edit.git
synced 2026-01-12 23:11:06 +11:00
removed redundant timeout
This commit is contained in:
parent
2f2aff8614
commit
be79cf4652
1 changed files with 7 additions and 9 deletions
|
|
@ -65,15 +65,13 @@ export class ThemeHandler {
|
||||||
|
|
||||||
// Listen for system theme changes (only if user hasn't set a preference)
|
// Listen for system theme changes (only if user hasn't set a preference)
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
||||||
setTimeout(() => {
|
if (!localStorage.getItem(STORAGE_KEY_MODE)) {
|
||||||
if (!localStorage.getItem(STORAGE_KEY_MODE)) {
|
this.state.value.currentMode = e.matches ? 'dark' : 'light'
|
||||||
this.state.value.currentMode = e.matches ? 'dark' : 'light'
|
this.applyTheme()
|
||||||
this.applyTheme()
|
}
|
||||||
}
|
else {
|
||||||
else {
|
this.applyTheme()
|
||||||
this.applyTheme()
|
}
|
||||||
}
|
|
||||||
}, 10)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue