From c13b7f4af7d55f717b8147c2debb0faef704c6cb Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 26 Aug 2023 15:55:16 -0500 Subject: [PATCH] subs: allow any object in place of the socket --- src/subs.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/subs.ts b/src/subs.ts index eebfac1b..f9d66061 100644 --- a/src/subs.ts +++ b/src/subs.ts @@ -9,7 +9,7 @@ import type { EventData } from '@/types.ts'; * Subscriptions can be added, removed, and matched against events. */ class SubscriptionStore { - #store = new Map>(); + #store = new Map>(); /** * Add a subscription to the store, and then iterate over it. @@ -20,7 +20,7 @@ class SubscriptionStore { * } * ``` */ - sub(socket: WebSocket, id: string, filters: DittoFilter[]): Subscription { + sub(socket: unknown, id: string, filters: DittoFilter[]): Subscription { let subs = this.#store.get(socket); if (!subs) { @@ -37,13 +37,13 @@ class SubscriptionStore { } /** Remove a subscription from the store. */ - unsub(socket: WebSocket, id: string): void { + unsub(socket: unknown, id: string): void { this.#store.get(socket)?.get(id)?.close(); this.#store.get(socket)?.delete(id); } /** Remove an entire socket. */ - close(socket: WebSocket): void { + close(socket: unknown): void { const subs = this.#store.get(socket); if (subs) {