forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
socket.io-client.d.ts
45 lines (39 loc) · 1.44 KB
/
socket.io-client.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
// Type definitions for socket.io-client 1.2.0
// Project: http://socket.io/
// Definitions by: PROGRE <https://github.com/progre/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var io: SocketIOClientStatic;
declare module 'socket.io-client' {
export = io;
}
interface SocketIOClientStatic {
(host: string, details?: any): SocketIOClient.Socket;
(details?: any): SocketIOClient.Socket;
connect(host: string, details?: any): SocketIOClient.Socket;
connect(details?: any): SocketIOClient.Socket;
protocol: number;
Socket: { new (...args: any[]): SocketIOClient.Socket };
Manager: SocketIOClient.ManagerStatic;
}
declare module SocketIOClient {
interface Socket {
on(event: string, fn: Function): Socket;
once(event: string, fn: Function): Socket;
off(event?: string, fn?: Function): Socket;
emit(event: string, ...args: any[]): Socket;
listeners(event: string): Function[];
hasListeners(event: string): boolean;
connected: boolean;
}
interface ManagerStatic {
(url: string, opts: any): SocketIOClient.Manager;
new (url: string, opts: any): SocketIOClient.Manager;
}
interface Manager {
reconnection(v: boolean): Manager;
reconnectionAttempts(v: boolean): Manager;
reconnectionDelay(v: boolean): Manager;
reconnectionDelayMax(v: boolean): Manager;
timeout(v: boolean): Manager;
}
}