Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async onLiveShareSessionChanged(api: LiveShare, e: SessionChangeEvent) {
if (this._host !== undefined) {
this._host.dispose();
}
if (this._guest !== undefined) {
this._guest.dispose();
}
switch (e.session.role) {
case Role.Host:
this.setReadonly(false);
setCommandContext(CommandContext.Vsls, 'host');
if (Container.config.liveshare.allowGuestAccess) {
this._host = await VslsHostService.share(api);
}
break;
case Role.Guest:
this.setReadonly(true);
setCommandContext(CommandContext.Vsls, 'guest');
this._guest = await VslsGuestService.connect(api);
break;
default:
this.setReadonly(false);
setCommandContext(CommandContext.Vsls, true);
break;