source: imaps-frontend/node_modules/undici-types/eventsource.d.ts

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import { MessageEvent, ErrorEvent } from './websocket'
2import Dispatcher from './dispatcher'
3
4import {
5 EventListenerOptions,
6 AddEventListenerOptions,
7 EventListenerOrEventListenerObject
8} from './patch'
9
10interface EventSourceEventMap {
11 error: ErrorEvent
12 message: MessageEvent
13 open: Event
14}
15
16interface EventSource extends EventTarget {
17 close(): void
18 readonly CLOSED: 2
19 readonly CONNECTING: 0
20 readonly OPEN: 1
21 onerror: (this: EventSource, ev: ErrorEvent) => any
22 onmessage: (this: EventSource, ev: MessageEvent) => any
23 onopen: (this: EventSource, ev: Event) => any
24 readonly readyState: 0 | 1 | 2
25 readonly url: string
26 readonly withCredentials: boolean
27
28 addEventListener<K extends keyof EventSourceEventMap>(
29 type: K,
30 listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
31 options?: boolean | AddEventListenerOptions
32 ): void
33 addEventListener(
34 type: string,
35 listener: EventListenerOrEventListenerObject,
36 options?: boolean | AddEventListenerOptions
37 ): void
38 removeEventListener<K extends keyof EventSourceEventMap>(
39 type: K,
40 listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
41 options?: boolean | EventListenerOptions
42 ): void
43 removeEventListener(
44 type: string,
45 listener: EventListenerOrEventListenerObject,
46 options?: boolean | EventListenerOptions
47 ): void
48}
49
50export declare const EventSource: {
51 prototype: EventSource
52 new (url: string | URL, init?: EventSourceInit): EventSource
53 readonly CLOSED: 2
54 readonly CONNECTING: 0
55 readonly OPEN: 1
56}
57
58interface EventSourceInit {
59 withCredentials?: boolean,
60 dispatcher?: Dispatcher
61}
Note: See TracBrowser for help on using the repository browser.