forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sockjs.d.ts
52 lines (46 loc) · 1.28 KB
/
sockjs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Type definitions for SockJS 0.3.x
// Project: https://github.com/sockjs/sockjs-client
// Definitions by: Emil Ivanov <https://github.com/vladev>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface SockJSSimpleEvent {
type: string;
toString(): string;
}
interface SJSOpenEvent extends SockJSSimpleEvent {}
interface SJSCloseEvent extends SockJSSimpleEvent {
code: number;
reason: string;
wasClean: boolean;
}
interface SJSMessageEvent extends SockJSSimpleEvent {
data: string;
}
interface SockJS extends EventTarget {
protocol: string;
readyState: number;
onopen: (ev: SJSOpenEvent) => any;
onmessage: (ev: SJSMessageEvent) => any;
onclose: (ev: SJSCloseEvent) => any;
send(data: any): void;
close(code?: number, reason?: string): void;
OPEN: number;
CLOSING: number;
CONNECTING: number;
CLOSED: number;
}
declare var SockJS: {
prototype: SockJS;
new (url: string, _reserved?: any, options?: {
debug?: boolean;
devel?: boolean;
protocols_whitelist?: string[];
server?: string;
rtt?: number;
rto?: number;
info?: {
websocket?: boolean;
cookie_needed?: boolean;
null_origin?: boolean;
};
}): SockJS;
};