import { RouterListenerUnsubscribe } from "../../clients/routerClient"; import PublicEventManager, { Unsubscriber } from "./PublicEventManager"; declare type EventOptions = { initialQueryTimeout: Number; timeout: Number; }; /** * This private Event Manager distributes events to remove event handlers (using the router). * It is used within the windowService and workspaceService. Clients use the PublicEventManager * in order to register and unregister handlers. * * The primary use is for FinsembleWindow events. FinsembleWindow is derived from PublicEventManager. * * The windowService will create multiple PrivateEventManagers, generally one per live window. Each * PrivateEventManager maintains its own private store of remote event handlers. Note that event handlers * may exist across multiple windows. For instance, a window called "Bobby" may want to know when another * window called "Gary" closes. When Bobby registers an event handler ("tell me when Gary closes") then * Gary's PrivateEventManager will gain a handler, which is associated with Bobby. * * In the above scenario, if Bobby (client) closes then Gary's PrivateEventManager will remove all references * to remote event handlers. But, if Gary closes then Bobby's references will become orphans - never triggered, * which is probably fine for most application logic. * * For more information on the distrubted event architecture - see https://miro.com/app/board/o9J_kwhN9zo=/ * * Note, this class can also be used as a *local* event manager with the functions. */ declare class EventManager extends PublicEventManager { #private; eventList: string[]; eventInternalHandlerMap: Record; remoteListenerEventMap: Record; windowToGuidsMap: Record; waitList: Record; unsubscribes: RouterListenerUnsubscribe[]; /** *Creates an instance of EventManager. * @param {*} params * @memberof EventManager */ constructor(params: { name: string; sourceType?: string; }); /** * Removes all listeners associated with a window [that has closed] */ private removeWindow; /** * Removes all listeners for a specific remote guid */ private removeGuid; /** * Adds an individual remote listener (listenerGuid+event) to this event manager */ registerRemoteEventHandler(event: string, listenerGuid: string, listenerWindow: string): void; /** * Removes an individual remote listener (listenerGuid+event) from this event manager */ unregisterRemoteEventHandler(event: string, listenerGuid: string, listenerWindow: string): void; /** * We must wait for a remote transit if delayed * * @memberof EventManager */ awaitRemoteDelayer(eventGuid: string, listenerGuid: string): Promise; /** * Sends a message to a remote listener (PublicEventManager) which will then emit a local Finsemble event. * * Called by this.trigger(). */ private queryRemoteListener; /** * Forwards an event to all remote listeners and then waits for them to respond. * They may optionally interrupt the event by sending a "cancel" which results in FinsembleEvent throwing * an exception. Any individual exception will cause this function to also throw an exception, thus * interrupting the event (which occurs upstream, e.g. preventing a window from closing). */ trigger(event: string, data?: any, options?: EventOptions): Promise; /** * Adds a *local* event listener. */ addEventListener(event: string, handler: Function): Unsubscriber; /** * Removes a *local* event listener. */ removeEventListener(event: string, handler: Function): void; /** * Removes all router listeners and subscriptions. This is called when the windowService terminates this * PrivateEventManager (e.g. because the window has closed). */ cleanup(): void; } export default EventManager; //# sourceMappingURL=PrivateEventManager.d.ts.map