Name a type for event data

Use a named type for the EventData used in subscriptions.  This was done
as a workaround for a bug in the linter.
This commit is contained in:
Hornwitser committed 2023-11-20 14:43:03 +01:00
1 parent 2a1821993c
commit 9f31394318
1 file changed
+6 -4
+6 -4
View File
@@ -110,15 +110,17 @@ export class SubscriptionRequest {
}
}
type EventData = {
subscriptionUpdate?: SubscriptionRequestHandler<unknown>,
subscriptions: Map<Link, { all: boolean, channels: Array<string | number>, onceClose: () => void }>,
};
/**
* A class component to handle incoming subscription requests and offers a method to broadcast events to subscribers
* After creation, no other handler can be registered for SubscriptionRequest on the controller
*/
export class SubscriptionController {
_events = new Map<string, {
subscriptionUpdate?: SubscriptionRequestHandler<unknown>,
subscriptions: Map<Link, { all: boolean, channels: Array<string | number>, onceClose: () => void }>,
}>();
_events = new Map<string, EventData>();
constructor(
private controller: any, // Controller | Link