a rpc lib for vscode webview extension development
- node >=10
yarn add vscode-webview-rpc
extension rpc
import * as vscode from 'vscode';
import { ExtensionRPC } from 'vscode-webview-rpc';
const panel = vscode.window.createWebviewPanel(
'EditPanel',
'Blog Editing',
column || vscode.ViewColumn.One,
getWebviewOptions(extensionUri),
);
const RPC = new ExtensionRPC(panel.webview);
RPC.on('log',(e)=>{
console.log(e);
return Promise.resolve();
});
webview rpc
import { WebviewRPC } from 'vscode-webview-rpc';
declare var acquireVsCodeApi: any;
let RPC:WebviewRPC;
(()=>{
RPC = new WebRPC(window, vscode);
setTimeout(()=>{
RPC.emit('log',["hello world"]);
},2000);
})();
👤 aaronphy
- Github: @Aaronphy
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator