import * as comlink from 'comlink' ; import { Endpoint } from 'comlink' ; import RPCWebviewHandle from './rpc-webview-handle' ; declare const acquireVsCodeApi ; const vscodeApi = acquireVsCodeApi ( ) ; class WebviewProxy implements Endpoint { postMessage ( message ) { vscodeApi . postMessage ( message ) ; } addEventListener = self . addEventListener . bind ( self ) ; removeEventListener = self . removeEventListener . bind ( self ) ; } let ExtensionHandle ; export function initRPCWebviewSide ( ) { const webviewEndpont = new WebviewProxy ( ) ; ExtensionHandle = comlink . proxy ( webviewEndpont ) ; const webviewHandle = new RPCWebviewHandle ( ) ; comlink . expose ( webviewHandle , webviewEndpont ) ; ExtensionHandle . handshake ( ) ; } export { ExtensionHandle } ;