rx-postmessenger
Version:
Minimal RxJS adapter for the window.postMessage API for request-response streams and notification streams across frame windows.
10 lines (9 loc) • 569 B
TypeScript
import type { IMessageFactory, IMessageIDGenerator, INotificationObject, IRequestObject, IResponseObject } from './types';
export declare class MessageFactory implements IMessageFactory {
protected readonly IDGenerator: IMessageIDGenerator;
constructor(IDGenerator: IMessageIDGenerator);
makeNotification<T>(channel: string, payload: T): INotificationObject<T>;
makeRequest<T>(channel: string, payload: T): IRequestObject<T>;
makeResponse<T>(requestId: string, channel: string, payload: T): IResponseObject<T>;
invalidateID(id: string): void;
}