@sanity/eventsource

v5.0.2
EventSource polyfill for browser and node.js
sanity cms headless realtime content eventsource polyfill

@sanity/eventsource

npm stat npm version gzip size size

Meta-package to make browsers and Node use different EventSource polyfills

npm install @sanity/eventsource

Usage

import polyfilledEventSource from '@sanity/eventsource'

The polyfill adds support for auth headers, which isn't part of the EventSource spec.

In NodeJS environments it's the implementation from eventsource package. While browsers use event-source-polyfill.

Forcing a specific implementation

To get the browser implementation, no matter how your bundler or runtime understands package.json exports, you can use the following:

import polyfilledEventSource from '@sanity/eventsource/browser'

To force the Node implementation, use the following:

import polyfilledEventSource from '@sanity/eventsource/node'

License

MIT © Sanity.io

npm i @sanity/[email protected]

Metadata

  • MIT
  • Whatever
  • Sanity.io
  • released 4/22/2024

Downloads