phihag / event-source-polyfill

A minimum immplementation of EventSource for IE11 and Edge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

A minimum immplementation of EventSource for IE11 and Edge

License:MIT License


Languages

Language:TypeScript 90.6%Language:JavaScript 9.4%