New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eventsource

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventsource - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

49

dist/index.d.ts

@@ -1,2 +0,14 @@

/// <reference path="events.d.ts" />
/**
* Mirrors the official DOM typings (sorta).
*
* @public
*/
export declare interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
signal?: AbortSignal
}

@@ -28,2 +40,37 @@ /**

/**
* Mirrors the official DOM typings.
*
* @public
*/
export declare interface EventListener {
(evt: Event | MessageEvent): void
}
/**
* Mirrors the official DOM typings.
*
* @public
*/
export declare interface EventListenerObject {
handleEvent(object: Event): void
}
/**
* Mirrors the official DOM typings (sorta).
*
* @public
*/
export declare interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean
}
/**
* Mirrors the official DOM typings.
*
* @public
*/
export declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject
/**
* An `EventSource` instance opens a persistent connection to an HTTP server, which sends events

@@ -30,0 +77,0 @@ * in `text/event-stream` format. The connection remains open until closed by calling `.close()`.

4

package.json
{
"name": "eventsource",
"version": "3.0.2",
"version": "3.0.3",
"description": "WhatWG/W3C compliant EventSource client for Node.js and browsers",

@@ -22,3 +22,3 @@ "sideEffects": false,

"scripts": {
"build": "pkg-utils build && pkg-utils --strict && tsx scripts/referenceEventTypings.ts",
"build": "pkg-utils build && pkg-utils --strict",
"build:watch": "pkg-utils watch",

@@ -25,0 +25,0 @@ "clean": "rimraf dist coverage",

@@ -74,2 +74,24 @@ # eventsource

### TypeScript
Make sure you have configured your TSConfig so it matches the environment you are targetting. If you are targetting browsers, this would be `dom`:
```jsonc
{
"compilerOptions": {
"lib": ["dom"],
},
}
```
If you're using Node.js, ensure you have `@types/node` installed (and it is version 18 or higher). Cloudflare workers have `@cloudflare/workers-types` etc.
The following errors are caused by targetting an environment that does not have the necessary types available:
```
error TS2304: Cannot find name 'Event'.
error TS2304: Cannot find name 'EventTarget'.
error TS2304: Cannot find name 'MessageEvent'.
```
## Migrating from v1 / v2

@@ -76,0 +98,0 @@

@@ -5,2 +5,5 @@ import {createParser, type EventSourceMessage, type EventSourceParser} from 'eventsource-parser'

import type {
AddEventListenerOptions,
EventListenerOptions,
EventListenerOrEventListenerObject,
EventSourceEventMap,

@@ -7,0 +10,0 @@ EventSourceInit,

@@ -89,1 +89,50 @@ import type {ErrorEvent} from './errors.js'

}
/**
* Mirrors the official DOM typings (sorta).
*
* @public
*/
export interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean
}
/**
* Mirrors the official DOM typings (sorta).
*
* @public
*/
export interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
signal?: AbortSignal
}
/**
* Mirrors the official DOM typings.
*
* @public
*/
export type EventListenerOrEventListenerObject = EventListener | EventListenerObject
/**
* Mirrors the official DOM typings.
*
* @public
*/
export interface EventListener {
(evt: Event | MessageEvent): void
}
/**
* Mirrors the official DOM typings.
*
* @public
*/
export interface EventListenerObject {
handleEvent(object: Event): void
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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