@dataql/node
Version:
DataQL core SDK for unified data management with MongoDB and GraphQL - Production Multi-Cloud Ready
43 lines (42 loc) • 1.12 kB
TypeScript
import { PluginEventSystem } from "./types.js";
/**
* Event system implementation for DataQL plugins
*
* Provides a simple but powerful event system that allows plugins
* to communicate with each other and react to DataQL events.
*/
export declare class PluginEventEmitter implements PluginEventSystem {
private eventListeners;
/**
* Emit an event to all listeners
*/
emit(event: string, data: any): void;
/**
* Add an event listener
*/
on(event: string, handler: (data: any) => void): void;
/**
* Add a one-time event listener
*/
once(event: string, handler: (data: any) => void): void;
/**
* Remove an event listener
*/
off(event: string, handler?: (data: any) => void): void;
/**
* Get all listeners for an event
*/
listeners(event: string): Function[];
/**
* Get all events that have listeners
*/
eventNames(): string[];
/**
* Get the total number of listeners across all events
*/
listenerCount(): number;
/**
* Clear all listeners
*/
removeAllListeners(): void;
}