Skip to content

Commit

Permalink
fix: replace typeof window with import.meta.client
Browse files Browse the repository at this point in the history
  • Loading branch information
madebyfabian committed Jan 25, 2024
1 parent 8403338 commit e62673a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/runtime/composables/useCalendly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useCalendly = (): CalendlyClient => {
})

const getCalendly = async () => {
if (typeof window === undefined) return
if (!import.meta.client) return
const calendly = await attemptToLoadWidgetScript()
if (!calendly) return
return calendly
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/composables/useCalendlyEventListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export default function useCalendlyEventListener(eventHandlers: CalendlyEventHan
}

onMounted(() => {
if (typeof window === undefined) return
if (!import.meta.client) return
window.addEventListener(EVENT_NAME, onMessage)
})

onUnmounted(() => {
if (typeof window === undefined) return
if (!import.meta.client) return
window.removeEventListener(EVENT_NAME, onMessage)
})
}

1 comment on commit e62673a

@vercel
Copy link

@vercel vercel bot commented on e62673a Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.