chore(web): passive events (#19179)

This commit is contained in:
Mert
2025-06-16 11:03:23 -04:00
committed by GitHub
parent 3d0c851636
commit 5fc448bc97
12 changed files with 68 additions and 58 deletions

View File

@@ -52,11 +52,15 @@ class ThemeManager {
}
#onAppInit() {
globalThis.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
if (this.theme.system) {
this.#update('system');
}
});
globalThis.matchMedia('(prefers-color-scheme: dark)').addEventListener(
'change',
() => {
if (this.theme.system) {
this.#update('system');
}
},
{ passive: true },
);
}
#update(value: Theme | 'system') {