We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd9a2d2 commit 9f638c9Copy full SHA for 9f638c9
packages/@headlessui-vue/src/hooks/use-window-event.ts
@@ -5,6 +5,8 @@ export function useWindowEvent<TType extends keyof WindowEventMap>(
5
listener: (this: Window, ev: WindowEventMap[TType]) => any,
6
options?: boolean | AddEventListenerOptions
7
) {
8
+ if (typeof window === 'undefined') return
9
+
10
watchEffect(onInvalidate => {
11
window.addEventListener(type, listener, options)
12
0 commit comments