structured-channel
Version:
A wrapper around MessageChannel API for bi-directional communication between two browsing contexts.
10 lines (9 loc) • 337 B
TypeScript
export declare type MessageType = 'x-channel-internal-reply' | 'x-channel-internal-hello' | string;
export declare type MessagePayload = string | number | any[] | Record<string, any>;
export interface MessageData {
id: number;
type: MessageType;
payload?: MessagePayload;
error?: any;
result?: Record<string, any>;
}