1.0.0 • Published 1 year ago

cross-eventsource v1.0.0

Weekly downloads
-
License
(MIT OR Apache-2....
Repository
-
Last release
1 year ago

cross-eventsource

Provides EventSource for Node.js and browser.

If in browser, use standard globalThis.EventSource. If in Node.js, use EventSource implementation of eventsource package.

Installation

pnpm add cross-eventsource

Usage

import { EventSource  } from "cross-eventsource";

// And then use it like in a browser
const source = new EventSource('http://localhost/feed')
source.addEventListener('message', (event) => {
  console.log('message', event)
})
source.addEventListener('error', error => {
  console.log('error', error)
})
console.log('listening...')
1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago