We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36815e3 commit d279738Copy full SHA for d279738
packages/spectacle/src/hooks/use-broadcast-channel.ts
@@ -4,7 +4,11 @@ import { BroadcastChannel as BroadcastChannelPolyfill } from 'broadcast-channel'
4
import { DeckView } from './use-deck-state';
5
6
const noop = () => {};
7
-const BroadcastChannel = window.BroadcastChannel || BroadcastChannelPolyfill;
+let safeWindow: any = {};
8
+if (typeof window !== "undefined") {
9
+ safeWindow = window;
10
+}
11
+const BroadcastChannel = safeWindow.BroadcastChannel || BroadcastChannelPolyfill;
12
13
type MessageCallback = (message: MessageTypes) => void;
14
0 commit comments