Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Simplifying LS code
Browse files Browse the repository at this point in the history
  • Loading branch information
lostintangent committed Jul 2, 2019
1 parent 2cab0a7 commit eb72f38
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 12 additions & 19 deletions src/services/liveShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@ export async function initialize(
}

liveShare.onDidChangeSession(e => {
const liveShareProfile = config.getLiveShareProfile();
if (!liveShareProfile) {
return;
}

if (e.session.id) {
const liveShareProfile = config.getLiveShareProfile();
if (!liveShareProfile) {
return;
}

activateProfileHandler(liveShareProfile);
} else {
restorePreviousProfile(config, activateProfileHandler);
const previousProfile = config.getPreviousProfile();
if (!previousProfile) {
return;
}

config.setPreviousProfile(undefined);
activateProfileHandler(previousProfile);
}
})
}

function restorePreviousProfile(
config: Config,
activateProfileHandler: (profile: string) => void
) {
const previousProfile = config.getPreviousProfile();
if (!previousProfile) {
return;
}

config.setPreviousProfile(undefined);
activateProfileHandler(previousProfile);
}

0 comments on commit eb72f38

Please # to comment.