Fix SignalR declarations and files

This commit is contained in:
Boris Yankov
2012-11-13 16:33:05 +02:00
parent bc9e90c16c
commit c00279d3d3
2 changed files with 20 additions and 13 deletions
+8 -11
View File
@@ -23,13 +23,13 @@ interface SignalREvents {
interface SignalR {
events: SignalREvents;
connectionState: any; // ???
connectionState: any;
transports: any;
hub: HubConnection;
id: string; // ???
id: string;
logging: bool;
messageId: string; // ???
messageId: string;
url: string;
(url: string, queryString?: any, logging?: bool): SignalR;
@@ -40,12 +40,12 @@ interface SignalR {
changeState(connection: SignalR, expectedState: number, newState: number): bool;
isDisconnecting(connection: SignalR): bool;
createHubProxy(hubName: string): SignalR;
// createHubProxy(hubName: string): SignalR;
start(): SignalR;
start(callback: () => void ): SignalR;
start(settings: ConnectionSettings): SignalR;
start(settings: ConnectionSettings, callback: () => void ): SignalR;
start(): JQueryPromise;
start(callback: () => void ): JQueryPromise;
start(settings: ConnectionSettings): JQueryPromise;
start(settings: ConnectionSettings, callback: () => void ): JQueryPromise;
send(data: string): void;
@@ -59,9 +59,6 @@ interface SignalR {
connectionSlow(handler: () => void ): SignalR;
sending(handler: () => void ): SignalR;
reconnected(handler: () => void ): SignalR;
done(handler: () => void ): SignalR;
fail(handler: () => void ): SignalR;
}
interface HubProxy {
+12 -2
View File
@@ -50,6 +50,16 @@ function test_connection() {
});
}
interface MyHubConnection extends HubConnection {
someState: string;
SomeFunction: Function;
}
interface SignalR {
chat: HubConnection;
myHub: MyHubConnection;
}
function test_hubs() {
var chat = $.connection.chat;
chat.client.addMessage = function (message) {
@@ -69,7 +79,7 @@ function test_hubs() {
function connectionReady() {
alert("Done calling first hub serverside-function");
};
myHub.SomeClientFunction = function () {
myHub.SomeFunction = function () {
alert("serverside called 'Clients.SomeClientFunction()'");
};
$.connection.hub.error(function () {
@@ -77,7 +87,7 @@ function test_hubs() {
});
$.connection.hub.start()
.done(function () {
myHub.SomeFunction(SomeParam)
myHub.SomeFunction("whatever")
.done(connectionReady);
})
.fail(function () {