Skip to content

Commit 497e022

Browse files
authored
refactor: Themes emitter SSR initialization (#1449)
1 parent 78663a1 commit 497e022

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/theming/theming-event.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import { isServer } from 'lit';
12
import type { Theme, ThemeVariant } from './types.js';
23

34
class ThemeChangedEmitter extends EventTarget {
45
constructor() {
56
super();
6-
globalThis.addEventListener(CHANGE_THEME_EVENT, this);
7+
if (!isServer) {
8+
globalThis.addEventListener(CHANGE_THEME_EVENT, this);
9+
}
710
}
811

912
public handleEvent() {

0 commit comments

Comments
 (0)