How to use the vsls.Role function in vsls

To help you get started, we’ve selected a few vsls 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 vsls-contrib / whiteboard / src / extension.ts View on Github external
vscode.commands.registerCommand("liveshare.openWhiteboard", async () => {
      if (webviewPanel) {
        return webviewPanel.reveal();
      } else {
        webviewPanel = createWebView(context);

        // If the end-user closes the whiteboard, then we
        // need to ensure we re-created it on the next click.
        webviewPanel.onDidDispose(() => (webviewPanel = null));
      }

      let { default: initializeService } =
        vslsApi.session.role === vsls.Role.Host
          ? require("./service/hostService")
          : require("./service/guestService");

      await initializeService(vslsApi, webviewPanel, treeDataProvider);
    })
  );
github johnpapa / vscode-peacock / src / live-share / integration.ts View on Github external
export async function refreshLiveShareSessionColor(isHostRole: boolean): Promise {
  const vslsApi = await vsls.getApi();

  // not in Live Share session, no need to update
  if (!vslsApi || !vslsApi.session.id) {
    const verb = isHostRole ? 'host and share' : 'join';

    notify(`The selected color will be applied every time you ${verb} a Live Share session.`, true);

    return false;
  }

  const isHost = vslsApi.session.role === vsls.Role.Host;
  await setLiveShareSessionWorkspaceColors(isHost);
  return true;
}

vsls

Enables VS Code extensions to access Live Share capabilities.

CC-BY-4.0
Latest version published 3 years ago

Package Health Score

63 / 100
Full package analysis