@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) • 810 B
TypeScript
/**
* This file is a copy of the resolver from the `codesandbox-api` package.
* We wanted to avoid to reference codesandbox-api because of the code that runs on load in the package.
* The plan is to take some time and refactor codesandbox-api into what it was supposed to be in the first place,
* an abstraction over the actions that can be dispatched between the bundler and the iframe.
*/
import type { IFrameProtocol } from "./iframe-protocol";
import type { ProtocolRequestMessage } from "../../types";
export default class Protocol {
private type;
private handleMessage;
private protocol;
private _disposeMessageListener;
constructor(type: string, handleMessage: (message: ProtocolRequestMessage) => any, protocol: IFrameProtocol);
getTypeId(): string;
dispose(): void;
}