A polyfill implementing the W3C EventSource (Server-Sent Events) API for browsers that lack native support. Current stable version is 1.0.31. It fills gaps in older browsers like IE 10+ (XDomainRequest for IE 8-9 with limitations), Firefox 3.5+, Chrome 3+, Safari 4+, and Opera 12+. Key differentiators: cross-domain support, custom headers, and configurable last-event-id parameter. The README strongly discourages use ("Please do not use this shitty library!") due to quality concerns, but the package remains actively maintained for legacy compatibility.
npm install event-source-polyfillVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using EventSourcePolyfill with fallback to native, plus custom headers usage.
Consider using alternative libraries like 'eventsource' or 'fetch-event-source' which may be more reliable.
Ensure server adds 2KB of padding at the beginning of SSE responses for IE 8-9 compatibility.
Set custom 'lastEventIdQueryParameterName' option to match server expectations.
Add logic to pad chunks on server side for Android Browser support, or avoid targeting this browser.
Use import { NativeEventSource, EventSourcePolyfill } from 'event-source-polyfill'; const EventSource = NativeEventSource || EventSourcePolyfill;Run 'npm install event-source-polyfill' and ensure import path matches (no trailing slash).
Use import { EventSourcePolyfill } from 'event-source-polyfill' (named import).Use import 'event-source-polyfill' (side-effect import) or ensure named imports are used.
No dependency data recorded yet.