File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ export default {
55 template : "<div></div>" ,
66 mounted ( ) {
77 this . update_grid ( ) ;
8- this . $el . setAttribute ( "data-ag-theme-mode" , document . body . classList . contains ( "body--dark" ) ? "dark" : "light" )
9- this . themeObserver = new MutationObserver ( ( ) =>
10- this . $el . setAttribute ( "data-ag-theme-mode" , document . body . classList . contains ( "body--dark" ) ? "dark" : "light" )
11- ) ;
8+
9+ const updateTheme = ( ) =>
10+ this . $el . setAttribute ( "data-ag-theme-mode" , document . body . classList . contains ( "body--dark" ) ? "dark" : "light" ) ;
11+ this . themeObserver = new MutationObserver ( updateTheme ) ;
1212 this . themeObserver . observe ( document . body , { attributes : true , attributeFilter : [ "class" ] } ) ;
13+ updateTheme ( ) ;
1314 } ,
1415 unmounted ( ) {
1516 this . themeObserver . disconnect ( ) ;
You can’t perform that action at this time.
0 commit comments