UNPKG

@codesandbox/sdk

Version:
18 lines (17 loc) 914 B
import * as protocol from "../pitcher-protocol"; import { SandboxSession } from "../types"; import { SandboxClient } from "../SandboxClient"; import { Tracer } from "@opentelemetry/api"; export * from "../SandboxClient"; export { createPreview, Preview } from "./previews"; type ConnectToSandboxOptions = { session: SandboxSession; getSession: (id: string) => Promise<SandboxSession>; onFocusChange?: (cb: (isFocused: boolean) => void) => () => void; initStatusCb?: (event: protocol.system.InitStatus) => void; tracer?: Tracer; }; /** * Connect to a Sandbox from the browser and automatically reconnect. `getSession` requires and endpoint that resumes the Sandbox. `onFocusChange` can be used to notify when a reconnect should happen. */ export declare function connectToSandbox({ session, getSession, onFocusChange, initStatusCb, tracer, }: ConnectToSandboxOptions): Promise<SandboxClient>;