EventInterceptor
EventInterceptor
new EventInterceptor(client)
Parameter | Type | Optional |
---|---|---|
client | Client | ❌ |
Properties
public client: any
Methods
public destroy(): void
Destroys the event interceptor.
public getGlobalHandlersCount(): number
Returns the number of global handlers.
public getSubscriberCount(event): number
Returns the number of subscribers for the event.
Parameter | Type | Optional | Description |
---|---|---|---|
event | keyof | ClientEvents | ❌ |
public hasGlobalHandlers(): boolean
Whether the event has global handlers.
public hasSubscribers(event): boolean
Whether the event has subscribers.
Parameter | Type | Optional | Description |
---|---|---|---|
event | keyof | ClientEvents | ❌ |
public subscribe(event, listener, options?): (
...args | unknown[ | ] ) => void Subscribes to an event.
Parameter | Type | Optional | Description |
---|---|---|---|
event | Event | ❌ | The event to subscribe to. |
listener | ( args: ClientEvents,[,Event,] ) => void | ❌ | The listener to call when the event is emitted. |
options | EventInterceptorContextData<Event> | ✅ | N/A |
public unsubscribe(event, listener, reason?): void
Unsubscribes from an event.
Parameter | Type | Optional | Description |
---|---|---|---|
event | Event | ❌ | The event to unsubscribe from. |
listener | ( args: ClientEvents,[,Event,] ) => void | ❌ | N/A |
reason | string | ✅ | N/A |