Skip to content

Commit

Permalink
triggerEvent: check for undefined dispatchEvent (SSR)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylyeo committed May 26, 2023
1 parent 5e80230 commit 443c4f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/events/triggerEvent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EventType, Events } from './events'

export const triggerEvent = <T extends EventType>(type: EventType, data?: Events[T]) =>
globalThis.CustomEvent && globalThis.dispatchEvent(
globalThis.CustomEvent && globalThis.dispatchEvent?.(
new globalThis.CustomEvent('blockhead/event', {
detail: {
type,
Expand Down

0 comments on commit 443c4f6

Please sign in to comment.