forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-signalr-hub.d.ts
73 lines (60 loc) · 2.05 KB
/
angular-signalr-hub.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Type definitions for angular-signalr-hub v1.5.0
// Project: https://github.com/JustMaier/angular-signalr-hub
// Definitions by: Adam Santaniello <https://github.com/AdamSantaniello>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../signalr/signalr.d.ts' />
declare module ngSignalr {
interface HubFactory {
/**
* Creates a new Hub connection
*/
new(hubName: string, options: HubOptions) : Hub
}
class Hub {
hubName: string;
connection: SignalR;
proxy: HubProxy;
on(event: string, fn: (...args: any[]) => void): void;
invoke(method: string, ...args: any[]): JQueryDeferred<any>;
disconnect(): void;
connect(): JQueryPromise<any>;
}
interface HubOptions {
/**
* Collection of client side callbacks
*/
listeners?: { [index: string] : (...args: any[]) => void };
/**
* String array of server side methods which the client can call
*/
methods?: Array<string>;
/**
* Sets the root path for the SignalR web service
*/
rootPath?: string;
/**
* Object representing additional query params to be sent on connection
*/
queryParams?: { [index: string] : string };
/**
* Function to handle hub connection errors
*/
errorHandler?: (error: string) => void;
/**
* Enable/disable logging
*/
logging?: boolean;
/**
* Use a shared global connection or create a new one just for this hub, defaults to true
*/
useSharedConnection?: boolean;
/**
* Sets transport method (e.g 'longPolling' or ['webSockets', 'longPolling'] )
*/
transport?: any;
/**
* Function to handle hub connection state changed event
*/
stateChanged?: (state: SignalRStateChange) => void;
}
}