fix(core): update

This commit is contained in:
Philipp Kunz 2020-12-07 03:47:39 +00:00
parent 4456f00816
commit 286bb0887a

View File

@ -15,7 +15,7 @@ export class ThemeManager {
// lets care
this.goBrightBoolean = this.preferredColorSchemeMediaMatch.matches;
this.preferredColorSchemeMediaMatch.addEventListener('change', eventArg => {
this.preferredColorSchemeMediaMatch.addEventListener('change', (eventArg) => {
this.goBrightBoolean = eventArg.matches;
this.updateAllConnectedElements();
});
@ -23,7 +23,9 @@ export class ThemeManager {
}
private async updateAllConnectedElements() {
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
if (document.body && document.body.style) {
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
}
this.themeObservable.next(this.goBrightBoolean);
}