From 1fa1d659c75c18349e60c2eebdafd2eba4a6f976 Mon Sep 17 00:00:00 2001 From: Adam Santaniello Date: Fri, 7 Aug 2015 11:08:42 -0400 Subject: [PATCH] Changed tabs to spaces --- .../angular-signalr-hub-tests.ts | 140 +++++++++--------- angular-signalr-hub/angular-signalr-hub.d.ts | 128 ++++++++-------- 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/angular-signalr-hub/angular-signalr-hub-tests.ts b/angular-signalr-hub/angular-signalr-hub-tests.ts index db1b19b7e..61b9a7fb9 100644 --- a/angular-signalr-hub/angular-signalr-hub-tests.ts +++ b/angular-signalr-hub/angular-signalr-hub-tests.ts @@ -2,76 +2,76 @@ /// angular - .module('app', ['SignalR']) - .factory('Employees', ngSignalrTest.EmployeesFactory); + .module('app', ['SignalR']) + .factory('Employees', ngSignalrTest.EmployeesFactory); module ngSignalrTest { - export class EmployeesFactory { - static $inject = ['$rootScope', 'Hub', '$timeout']; - private hub: ngSignalr.Hub; - public all: Array; - - constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) { - // declaring the hub connection - this.hub = new Hub('employee', { - // client-side methods - listeners: { - 'lockEmployee': (id: number) => { - var employee = this.find(id); - employee.Locked = true; - $rootScope.$apply(); - }, - 'unlockEmployee': (id: number) => { - var employee = this.find(id); - employee.Locked = false; - $rootScope.$apply(); - } - }, - - // server-side methods - methods: ['lock', 'unlock'], - - // query params sent on initial connection - queryParams:{ - 'token': 'exampletoken' - }, - - // handle connection error - errorHandler: (message: string) => { - console.error(message); - }, - - stateChanged: (state: SignalRStateChange) => { - // your code here - } - }); - } - - private find(id: number) { - for (var i = 0; i < this.all.length; i++) { - if (this.all[i].Id === id) return this.all[i]; - } - - return null; - } - - public edit = (employee: Employee) => { - employee.Edit = true; - this.hub.invoke('lock', employee.Id); - }; - - public done = (employee: Employee) => { - employee.Edit = false; - this.hub.invoke('unlock', employee.Id); - } - } - - interface Employee { - Id: number; - Name: string; - Email: string; - Salary: number; - Edit: boolean; - Locked: boolean; - } + export class EmployeesFactory { + static $inject = ['$rootScope', 'Hub', '$timeout']; + private hub: ngSignalr.Hub; + public all: Array; + + constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) { + // declaring the hub connection + this.hub = new Hub('employee', { + // client-side methods + listeners: { + 'lockEmployee': (id: number) => { + var employee = this.find(id); + employee.Locked = true; + $rootScope.$apply(); + }, + 'unlockEmployee': (id: number) => { + var employee = this.find(id); + employee.Locked = false; + $rootScope.$apply(); + } + }, + + // server-side methods + methods: ['lock', 'unlock'], + + // query params sent on initial connection + queryParams:{ + 'token': 'exampletoken' + }, + + // handle connection error + errorHandler: (message: string) => { + console.error(message); + }, + + stateChanged: (state: SignalRStateChange) => { + // your code here + } + }); + } + + private find(id: number) { + for (var i = 0; i < this.all.length; i++) { + if (this.all[i].Id === id) return this.all[i]; + } + + return null; + } + + public edit = (employee: Employee) => { + employee.Edit = true; + this.hub.invoke('lock', employee.Id); + }; + + public done = (employee: Employee) => { + employee.Edit = false; + this.hub.invoke('unlock', employee.Id); + } + } + + interface Employee { + Id: number; + Name: string; + Email: string; + Salary: number; + Edit: boolean; + Locked: boolean; + } } \ No newline at end of file diff --git a/angular-signalr-hub/angular-signalr-hub.d.ts b/angular-signalr-hub/angular-signalr-hub.d.ts index cdd97299c..d1213cdf6 100644 --- a/angular-signalr-hub/angular-signalr-hub.d.ts +++ b/angular-signalr-hub/angular-signalr-hub.d.ts @@ -6,68 +6,68 @@ /// 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; - disconnect(): void; - connect(): JQueryPromise; - } - - 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; - - /** - * 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; - } + 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; + disconnect(): void; + connect(): JQueryPromise; + } + + 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; + + /** + * 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; + } } \ No newline at end of file