Permalink
Browse files

Fix SignalR declarations and files

  • Loading branch information...
1 parent bc9e90c commit c00279d3d33025fcf0c593d04a2a1f6e788d48e1 @borisyankov borisyankov committed Nov 13, 2012
Showing with 20 additions and 13 deletions.
  1. +8 −11 Definitions/signalr-1.0.d.ts
  2. +12 −2 Tests/signalr-tests.ts
View
19 Definitions/signalr-1.0.d.ts
@@ -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 {
View
14 Tests/signalr-tests.ts
@@ -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,15 +79,15 @@ 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 () {
alert("An error occured");
});
$.connection.hub.start()
.done(function () {
- myHub.SomeFunction(SomeParam)
+ myHub.SomeFunction("whatever")
.done(connectionReady);
})
.fail(function () {

0 comments on commit c00279d

Please sign in to comment.