@codesandbox/sandpack-client
Version:
<img style="width:100%" src="https://user-images.githubusercontent.com/4838076/143581035-ebee5ba2-9cb1-4fe8-a05b-2f44bd69bb4b.gif" alt="Component toolkit for live running code editing experiences" />
18 lines (17 loc) • 673 B
TypeScript
import type { ListenerFunction, SandpackMessage, UnsubscribeFunction } from "../../types";
export declare class IFrameProtocol {
private frameWindow;
private origin;
private globalListeners;
private globalListenersCount;
channelListeners: Record<number, ListenerFunction>;
private channelListenersCount;
readonly channelId: number;
constructor(iframe: HTMLIFrameElement, origin: string);
cleanup(): void;
register(): void;
dispatch(message: SandpackMessage): void;
globalListen(listener: ListenerFunction): UnsubscribeFunction;
channelListen(listener: ListenerFunction): UnsubscribeFunction;
private eventListener;
}