beaverjs
Version:
An abstraction around WebExtension messaging
17 lines (16 loc) • 908 B
TypeScript
import { BaseEventHandler } from './BaseEventHandler';
import { InternalMessageData, StructuredCloneData } from './types';
import { Destination } from './destination';
export declare class ContextEventHandler<EventMap extends Record<string, StructuredCloneData>> extends BaseEventHandler<EventMap, InternalMessageData, [
Destination | undefined
], undefined> {
emitBackground<K extends keyof EventMap>(key: K, data: EventMap[K]): void;
emitContent<K extends keyof EventMap>(key: K, data: EventMap[K]): void;
protected deserialize<K extends keyof EventMap>(serialized: InternalMessageData): {
type: K;
data: EventMap[K];
};
protected sendEvent(serialized: InternalMessageData, destination: Destination | undefined): void;
protected serialize<K extends keyof EventMap>(type: K, data: EventMap[K]): InternalMessageData;
protected setup(): void;
}