Replace deprecated MediaQueryList.addListener() (#12112)

This commit is contained in:
woxtu 2023-10-23 15:32:10 +09:00 committed by GitHub
parent 9dcccbc8e1
commit 4a832e87c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,7 @@ export async function common(createVue: () => App<Element>) {
defaultStore.set('darkMode', isDeviceDarkmode());
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(mql => {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (mql) => {
if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
defaultStore.set('darkMode', mql.matches);
}