Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
})
);
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;
}