1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | declare class EventSource {
|
8 | static readonly CLOSED: number;
|
9 | static readonly CONNECTING: number;
|
10 | static readonly OPEN: number;
|
11 |
|
12 | constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);
|
13 |
|
14 | readonly CLOSED: number;
|
15 | readonly CONNECTING: number;
|
16 | readonly OPEN: number;
|
17 | readonly url: string;
|
18 | readonly readyState: number;
|
19 | readonly withCredentials: boolean;
|
20 | onopen: (evt: MessageEvent) => any;
|
21 | onmessage: (evt: MessageEvent) => any;
|
22 | onerror: (evt: MessageEvent) => any;
|
23 | addEventListener(type: string, listener: (evt: MessageEvent) => void): void;
|
24 | dispatchEvent(evt: Event): boolean;
|
25 | removeEventListener(type: string, listener: (evt: MessageEvent) => void): void;
|
26 | close(): void;
|
27 | }
|
28 |
|
29 | declare namespace EventSource {
|
30 | enum ReadyState {
|
31 | CONNECTING = 0,
|
32 | OPEN = 1,
|
33 | CLOSED = 2,
|
34 | }
|
35 |
|
36 | interface EventSourceInitDict {
|
37 | withCredentials?: boolean | undefined;
|
38 | headers?: object | undefined;
|
39 | proxy?: string | undefined;
|
40 | https?: object | undefined;
|
41 | rejectUnauthorized?: boolean | undefined;
|
42 | }
|
43 | }
|
44 |
|
45 | export = EventSource;
|