removed redundant timeout

This commit is contained in:
Icy 2025-12-09 14:52:10 +05:30
parent 2f2aff8614
commit be79cf4652

View file

@ -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)
}) })
} }