import { EventEmitter } from './events'; import type { Emitter } from './emitter'; import type { EventEmitterOptionsType } from './events/types'; declare global { var $PRunningEventsServer: EventsServer; } /** * The idea of an event server is to keep the application running so that it can receive requests from other servers * and vice versa. * * It's kinda the same as how express works but the difference is that we do not start an http server and doesn't rely * on process.nextTick. * * IMPORTANT: This server is not tied to palmares, we create this here to wrap it around the actual EventsAppServer. The * idea is that this should not need to be tied to palmares and could work outside of it normally. */ export declare class EventsServer extends EventEmitter { #private; /** * This is used for appending the promise of adding the event listener to an array so when we initialize the server * we can wait for all the callbacks to be appended and listen for events. */ addEventListener(...params: Parameters): Promise<() => Promise>; /** * This is used for appending the promise of adding the event listener to an array so when we initialize the server * we can wait for all the callbacks to be appended and listen for events. */ addEventListenerWithoutResult(...params: Parameters): Promise<() => Promise>; /** * Listens for a request and keeps the application running, see here: * https://stackoverflow.com/questions/23622051/how-to-forcibly-keep-a-node-js-process-from-terminating/47456805#47456805 * * @param callback - Receives a function that should be called prior to starting the server. */ listen(callback: () => void): Promise; /** * If an interval had been created then we use this function to remove it so the connection is not kept alive. * * Also we use this so we can unsubscribe everything from the layer and unsubscribe all of it's listeners. */ close(): Promise; } export declare function eventsServer(emitter: Promise<{ default: TEmitter; }> | TEmitter, options?: EventEmitterOptionsType & { emitterParams?: Parameters; }): Promise>>; export declare function setEventsServer(server: EventsServer): void; export declare function getEventsServer(): EventsServer>; //# sourceMappingURL=server.d.ts.map