0.1.0 • Published 5 years ago

@mattkrick/event-source-polyfill v0.1.0

Weekly downloads
108
License
MIT
Repository
github
Last release
5 years ago

event-source-polyfill

EventSource polyfill for IE11 and Edge. Fully spec compliant: https://html.spec.whatwg.org/multipage/server-sent-events.html

Why?

Because no other polyfill follows the spec.

What's it do?

The exact same thing that a minimum implementation of EventSource does. No more, no less. For SSE that implements a heartbeat, see https://github.com/mattkrick/trebuchet-client/

Installation

yarn add @mattkrick/event-source-polyfill @mattkrick/event-target-polyfill

import EventTargetPolyfill from '@mattkrick/event-target-polyfill'
import EventSourcePolyfill from '@mattkrick/event-source-polyfill'

window.EventTarget = EventTargetPolyfill
window.EventSource = EventSourcePolyfill

NOTE: Make sure your browser supports EventTarget! If it doesn't use that polyfill, too.