undici-types 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eventsource.d.ts +61 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/websocket.d.ts +22 -1
package/eventsource.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { MessageEvent, ErrorEvent } from './websocket'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EventTarget,
|
|
5
|
+
Event,
|
|
6
|
+
EventListenerOptions,
|
|
7
|
+
AddEventListenerOptions,
|
|
8
|
+
EventListenerOrEventListenerObject
|
|
9
|
+
} from './patch'
|
|
10
|
+
|
|
11
|
+
interface EventSourceEventMap {
|
|
12
|
+
error: ErrorEvent
|
|
13
|
+
message: MessageEvent
|
|
14
|
+
open: Event
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface EventSource extends EventTarget {
|
|
18
|
+
close(): void
|
|
19
|
+
readonly CLOSED: 2
|
|
20
|
+
readonly CONNECTING: 0
|
|
21
|
+
readonly OPEN: 1
|
|
22
|
+
onerror: (this: EventSource, ev: ErrorEvent) => any
|
|
23
|
+
onmessage: (this: EventSource, ev: MessageEvent) => any
|
|
24
|
+
onopen: (this: EventSource, ev: Event) => any
|
|
25
|
+
readonly readyState: 0 | 1 | 2
|
|
26
|
+
readonly url: string
|
|
27
|
+
readonly withCredentials: boolean
|
|
28
|
+
|
|
29
|
+
addEventListener<K extends keyof EventSourceEventMap>(
|
|
30
|
+
type: K,
|
|
31
|
+
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
|
|
32
|
+
options?: boolean | AddEventListenerOptions
|
|
33
|
+
): void
|
|
34
|
+
addEventListener(
|
|
35
|
+
type: string,
|
|
36
|
+
listener: EventListenerOrEventListenerObject,
|
|
37
|
+
options?: boolean | AddEventListenerOptions
|
|
38
|
+
): void
|
|
39
|
+
removeEventListener<K extends keyof EventSourceEventMap>(
|
|
40
|
+
type: K,
|
|
41
|
+
listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
|
|
42
|
+
options?: boolean | EventListenerOptions
|
|
43
|
+
): void
|
|
44
|
+
removeEventListener(
|
|
45
|
+
type: string,
|
|
46
|
+
listener: EventListenerOrEventListenerObject,
|
|
47
|
+
options?: boolean | EventListenerOptions
|
|
48
|
+
): void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare const EventSource: {
|
|
52
|
+
prototype: EventSource
|
|
53
|
+
new (url: string | URL, init: EventSourceInit): EventSource
|
|
54
|
+
readonly CLOSED: 2
|
|
55
|
+
readonly CONNECTING: 0
|
|
56
|
+
readonly OPEN: 1
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface EventSourceInit {
|
|
60
|
+
withCredentials?: boolean
|
|
61
|
+
}
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/websocket.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type BinaryType = 'blob' | 'arraybuffer'
|
|
|
17
17
|
|
|
18
18
|
interface WebSocketEventMap {
|
|
19
19
|
close: CloseEvent
|
|
20
|
-
error:
|
|
20
|
+
error: ErrorEvent
|
|
21
21
|
message: MessageEvent
|
|
22
22
|
open: Event
|
|
23
23
|
}
|
|
@@ -124,6 +124,27 @@ export declare const MessageEvent: {
|
|
|
124
124
|
new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
interface ErrorEventInit extends EventInit {
|
|
128
|
+
message?: string
|
|
129
|
+
filename?: string
|
|
130
|
+
lineno?: number
|
|
131
|
+
colno?: number
|
|
132
|
+
error?: any
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface ErrorEvent extends Event {
|
|
136
|
+
readonly message: string
|
|
137
|
+
readonly filename: string
|
|
138
|
+
readonly lineno: number
|
|
139
|
+
readonly colno: number
|
|
140
|
+
readonly error: any
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare const ErrorEvent: {
|
|
144
|
+
prototype: ErrorEvent
|
|
145
|
+
new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent
|
|
146
|
+
}
|
|
147
|
+
|
|
127
148
|
interface WebSocketInit {
|
|
128
149
|
protocols?: string | string[],
|
|
129
150
|
dispatcher?: Dispatcher,
|