Skip to content

Commit

Permalink
Fix node compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
amortemousque committed Apr 14, 2022
1 parent 73ccf32 commit 238cf95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/transport/eventBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export function getEventBridge<T, E>() {
}
}

export function canUseEventBridge(hostname = window.location.hostname): boolean {
export function canUseEventBridge(hostname?: string): boolean {
const bridge = getEventBridge()
return (
!!bridge &&
bridge.getAllowedWebViewHosts().some((host) => {
const escapedHost = host.replace(/\./g, '\\.')
const isDomainOrSubDomain = new RegExp(`^(.+\\.)*${escapedHost}$`)
return !!isDomainOrSubDomain.exec(hostname)
return !!isDomainOrSubDomain.exec(hostname || window.location.hostname)
})
)
}
Expand Down

0 comments on commit 238cf95

Please sign in to comment.