@ea-utilities/mediator
Version:
Utility for the Mediator Pattern Mediator is a versatile class designed to streamline event-driven, asynchronous programming. It enables you to easily register, unregister, and invoke subscriber methods, making it ideal for managing WebSockets, Ajax call
13 lines (12 loc) • 575 B
TypeScript
import { IRequest } from './IRequest';
import * as i0 from "@angular/core";
export type MediatorOptions = {
onError?: <T extends IRequest>(error: unknown, event: T) => void;
};
export declare class Mediator {
private injector;
dispatch<T extends IRequest, IResponse = void>(event: T, options?: MediatorOptions): Promise<IResponse[]>;
dispatchSync<T extends IRequest, IResponse = void>(event: T, options?: MediatorOptions): IResponse[];
static ɵfac: i0.ɵɵFactoryDeclaration<Mediator, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<Mediator>;
}