File tree 2 files changed +33
-1
lines changed
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 1
1
typescript-server-sent-events
2
2
=============================
3
3
4
- TypeScript definitions for Server-Sent Events
4
+ TypeScript definitions for [ Server-Sent Events] ( http://dev.w3.org/html5/eventsource/ )
Original file line number Diff line number Diff line change
1
+ // Type definitions for Server-Sent Events
2
+ // Specification: http://dev.w3.org/html5/eventsource/
3
+ // Definitions by: Yannik Hampe <https://github.com/yankee42>
4
+
5
+ declare var EventSource : sse . IEventSourceStatic ;
6
+
7
+ declare module sse {
8
+
9
+ enum ReadyState { CONNECTING = 0 , OPEN = 1 , CLOSED = 2 }
10
+
11
+ interface IEventSourceStatic extends EventTarget {
12
+ new ( url : string , eventSourceInitDict ?: IEventSourceInit ) ;
13
+ url : string ;
14
+ withCredentials : boolean ;
15
+ CONNECTING : ReadyState ; // constant, always 0
16
+ OPEN : ReadyState ; // constant, always 1
17
+ CLOSED : ReadyState ; // constant, always 2
18
+ readyState : ReadyState ;
19
+ onopen : Function ;
20
+ onmessage : ( event : IOnMessageEvent ) => void ;
21
+ onerror : Function ;
22
+ close : ( ) => void ;
23
+ }
24
+
25
+ interface IEventSourceInit {
26
+ withCredentials ?: boolean ;
27
+ }
28
+
29
+ interface IOnMessageEvent {
30
+ data : string ;
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments