import { Channel, EndpointApiEvent } from './types'; /** * Class for handling events and registering listeners */ export declare class EventDispatcher { listeners: Map>; channels: Set; constructor(); /** * Add a event listeners on given channel and eventType * @param {Channel} channel channel * @param {string} eventType type of the event * @param {function} callback callback function * @returns {function} function to remove the event listeners */ addEventListener: (channel: Channel, eventType: EndpointApiEvent["type"], callback: Function) => (() => void); /** * Removes an event listeners from given `channel` and `eventType` * @param {Channel} channel channel * @param {string} eventType type of the event * @param {function} callback callback function */ removeEventListener: (channel: Channel, eventType: EndpointApiEvent["type"], callback: Function) => void; /** * Removes all event listeners * @returns {void} */ removeAllListeners: () => void; /** * Dispatches an event * @param {EndpointApiEvent} event * @returns {void} */ dispatchEvent: (event: EndpointApiEvent) => void; /** * Removes all listeners from given channel * @param {Channel} channel channel * @returns {void} */ removeChannelEvents: (channel: Channel) => void; /** * Checks whether the user is subscribed to given channel * @param channel Channel * @returns {boolean} `boolean` */ isSubscribedToChannel(channel: Channel): boolean; /** * Adds a channel subscription * @param {Channel} channel */ addChannelSubscription(channel: Channel): Set; /** * Removes a subscription on a channel and the event listeners assigned to it * @param {Channel} channel channel * * @returns {void} */ removeChannelSubscription(channel: Channel): void; }