Socket
Socket
Sign inDemoInstall

@rexxars/eventsource-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rexxars/eventsource-polyfill

A browser polyfill for W3C EventSource (http://www.w3.org/TR/eventsource/)


Version published
Weekly downloads
18K
increased by6.8%
Maintainers
1
Weekly downloads
 
Created
Source

EventSource Polyfill

Forked from amvtek/EventSource. See fork modification for more details.

Provide polyfill to support EventSource in browser where it is not available.

  • Used in production
  • Tested in Internet Explorer 8 +
  • Tested in Android browser 2.1 +
  • [Documented][]
  • Run the [Browser test suite][]

Installing

$ npm install @rexxars/eventsource-polyfill

Usage (through bundler)

const EventSource =
  typeof window !== 'undefined' && window.EventSource
    ? window.EventSource
    : require('@rexxars/eventsource-polyfill')

const es = new EventSource('/my-es-endpoint')

Usage (drop-in script)

<script src="https://unpkg.com/@rexxars/eventsource-polyfill"></script>
<script>
  var es = new EventSource('/my-es-endpoint')
</script>

Fork modifications

  • New package name: @rexxars/eventsource-polyfill
  • UMD module definition - CommonJS, AMD and browser globals
  • Fixed a few global variable leaks-
  • Check for window.location before usage (fixes react native crashing)
  • Stop dispatching events after closed

License

MIT-licensed. See LICENSE.

Keywords

FAQs

Package last updated on 14 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc