@custonomy/community-sdk
Version:
Custonomy Lib for Community
9 lines (7 loc) • 360 B
text/typescript
export function isNativeEventSourceAvailable(): boolean {
// Check if we're running in a browser environment by checking for 'window'
const isBrowser = typeof window !== 'undefined';
// Check if 'window.EventSource' is available
const isEventSourceAvailable = isBrowser && 'EventSource' in window;
return isEventSourceAvailable;
}