How to use @sap-devx/webview-rpc - 4 common examples

To help you get started, we’ve selected a few @sap-devx/webview-rpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / yeoman-ui / frontend / src / App.vue View on Github external
setupRpc() {
      if (this.isInVsCode()) {
        // eslint-disable-next-line
        window.vscode = acquireVsCodeApi()
        this.rpc = new RpcBrowser(window, window.vscode)
        this.initRpc()
      } else {
        const ws = new WebSocket("ws://127.0.0.1:8081")
        ws.onopen = () => {
          this.rpc = new RpcBrowserWebSockets(ws)
          this.initRpc()
        }
      }
    },
    initRpc() {
github SAP / yeoman-ui / backend / src / extension.ts View on Github external
private constructor(panel: vscode.WebviewPanel, extensionPath: string) {
		this.questionsResolutions = new Map();
		this.panel = panel;
		this.extensionPath = extensionPath;
		this.rpc = new RpcExtension(this.panel.webview);
		const logger: YouiLog = new OutputChannelLog();
		
		this.yeomanui = new YeomanUI(this.rpc, logger, YeomanUIPanel.genFilter);

		// Set the webview's initial html content
		this._update();

		// Listen for when the panel is disposed
		// This happens when the user closes the panel or when the panel is closed programatically
		this.panel.onDidDispose(() => this.dispose(), null, this.disposables);

		// Update the content based on view changes
		this.panel.onDidChangeViewState(
			e => {
				if (this.panel.visible) {
					this._update();
github SAP / yeoman-ui / backend / src / webSocketServer / index.ts View on Github external
wss.on('connection', (ws) => {
      console.log('new ws connection');

      this.rpc = new RpcExtensionWebSockets(ws);
      //TODO: Use RPC to send it to the browser log (as a collapsed pannel in Vue)
      const logger: YouiLog = new ServerLog(this.rpc);
      this.yeomanui = new YeomanUI(this.rpc, logger);
    });
  }
github SAP / yeoman-ui / frontend / src / App.vue View on Github external
ws.onopen = () => {
          this.rpc = new RpcBrowserWebSockets(ws)
          this.initRpc()
        }
      }

@sap-devx/webview-rpc

An RPC library for VSCode WebViews

Apache-2.0
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Similar packages