@@ -477,11 +477,11 @@ window
477477
478478let ignoreConfigEvent = false ;
479479
480- ConfigEvent . subscribe ( async ( eventKey , eventValue , nosave ) => {
481- if ( eventKey === "fullConfigChange" ) {
480+ ConfigEvent . subscribe ( async ( { key , newValue , nosave } ) => {
481+ if ( key === "fullConfigChange" ) {
482482 ignoreConfigEvent = true ;
483483 }
484- if ( eventKey === "fullConfigChangeFinished" ) {
484+ if ( key === "fullConfigChangeFinished" ) {
485485 ignoreConfigEvent = false ;
486486
487487 await clearRandom ( ) ;
@@ -506,26 +506,26 @@ ConfigEvent.subscribe(async (eventKey, eventValue, nosave) => {
506506 // once the full config is loaded, we can apply everything once
507507 if ( ignoreConfigEvent ) return ;
508508
509- if ( eventKey === "randomTheme" ) {
509+ if ( key === "randomTheme" ) {
510510 void changeThemeList ( ) ;
511511 }
512- if ( eventKey === "customTheme" ) {
513- ( eventValue as boolean ) ? await set ( "custom" ) : await set ( Config . theme ) ;
512+ if ( key === "customTheme" ) {
513+ newValue ? await set ( "custom" ) : await set ( Config . theme ) ;
514514 }
515- if ( eventKey === "customThemeColors" ) {
515+ if ( key === "customThemeColors" ) {
516516 nosave ? preview ( "custom" ) : await set ( "custom" ) ;
517517 }
518- if ( eventKey === "theme" ) {
518+ if ( key === "theme" ) {
519519 await clearRandom ( ) ;
520520 await clearPreview ( false ) ;
521- await set ( eventValue as string ) ;
521+ await set ( newValue as string ) ;
522522 }
523- if ( eventKey === "randomTheme" && eventValue === "off" ) await clearRandom ( ) ;
524- if ( eventKey === "customBackground" ) await applyCustomBackground ( ) ;
523+ if ( key === "randomTheme" && newValue === "off" ) await clearRandom ( ) ;
524+ if ( key === "customBackground" ) await applyCustomBackground ( ) ;
525525
526- if ( eventKey === "customBackgroundSize" ) applyCustomBackgroundSize ( ) ;
527- if ( eventKey === "autoSwitchTheme" ) {
528- if ( eventValue as boolean ) {
526+ if ( key === "customBackgroundSize" ) applyCustomBackgroundSize ( ) ;
527+ if ( key === "autoSwitchTheme" ) {
528+ if ( newValue ) {
529529 if ( prefersColorSchemeDark ( ) ) {
530530 await set ( Config . themeDark , true ) ;
531531 } else {
@@ -536,15 +536,15 @@ ConfigEvent.subscribe(async (eventKey, eventValue, nosave) => {
536536 }
537537 }
538538 if (
539- eventKey === "themeLight" &&
539+ key === "themeLight" &&
540540 Config . autoSwitchTheme &&
541541 ! prefersColorSchemeDark ( ) &&
542542 ! nosave
543543 ) {
544544 await set ( Config . themeLight , true ) ;
545545 }
546546 if (
547- eventKey === "themeDark" &&
547+ key === "themeDark" &&
548548 Config . autoSwitchTheme &&
549549 window . matchMedia !== undefined &&
550550 window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches &&
@@ -559,7 +559,7 @@ ConfigEvent.subscribe(async (eventKey, eventValue, nosave) => {
559559 "customThemeColors" ,
560560 "randomTheme" ,
561561 "favThemes" ,
562- ] . includes ( eventKey )
562+ ] . includes ( key )
563563 ) {
564564 updateFooterIndicator ( ) ;
565565 }
0 commit comments