@httpc/kit
Version:
httpc toolbox for building function-based API with minimal code and end-to-end type safety
21 lines (20 loc) • 941 B
TypeScript
/// <reference types="node" />
import EventEmitter from "events";
import type { IEvent, IEventBus } from "./types";
import type { ILogger } from "../logging";
import { ITransactionService } from "../services";
declare const EventBus_base: {
new (logger: ILogger, ...args: any[]): import("../services")._BaseService<"not_found" | "invalid_param" | "unauthorized" | "forbidden" | "not_allowed" | "invalid_state" | "misconfiguration" | "not_supported" | "processing_error">;
};
export declare class EventBus extends EventBus_base implements IEventBus {
protected _isHold: boolean;
protected _holdEvents: IEvent[];
constructor(logger: ILogger);
readonly events: EventEmitter;
inTransaction(data: ITransactionService): this;
addListener<T = object>(event: string, handler: (event: T) => void): () => EventEmitter;
publish(event: IEvent): void;
hold(): void;
flush(): void;
}
export {};