From c4eb501343758e536e9bd6c71c7a16d1042025d8 Mon Sep 17 00:00:00 2001 From: Olof Dahlbom Date: Wed, 28 Feb 2018 19:10:13 +0100 Subject: [PATCH] Emit warnings after off is called (#1513) * Emit warnings after off is called If a handler has been registered, and then gets unregistered, the key/methodname still exists in the map and signalr does not warn about a missing handler. Might be by design, but I like it this way. --- client-ts/signalr/src/HubConnection.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client-ts/signalr/src/HubConnection.ts b/client-ts/signalr/src/HubConnection.ts index ab5682f96c..16accc998a 100644 --- a/client-ts/signalr/src/HubConnection.ts +++ b/client-ts/signalr/src/HubConnection.ts @@ -267,6 +267,9 @@ export class HubConnection { const removeIdx = handlers.indexOf(method); if (removeIdx !== -1) { handlers.splice(removeIdx, 1); + if (handlers.length === 0) { + this.methods.delete(methodName); + } } }