Skip to content

Commit

Permalink
Fix patch for #21
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed Sep 9, 2017
1 parent 363f29a commit db07af5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/appModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as opn from 'opn';
export class AppModel {

private IsServerRunning: boolean;
private IsStaging: boolean;
private LiveServerInstance;
private runningPort: number;

Expand Down Expand Up @@ -48,6 +49,8 @@ export class AppModel {
let params = Helper.generateParams(pathInfos.rootPath, Config.getPort,
Config.getIgnoreFiles, workspacePath);

if (this.IsStaging) return;

LiveServerHelper.StartServer(params, (serverInstance) => {
if (serverInstance && serverInstance.address()) {
this.LiveServerInstance = serverInstance;
Expand All @@ -65,10 +68,9 @@ export class AppModel {
this.IsServerRunning = true; // to revert status - cheat :p
this.ToggleStatusBar(); // reverted
}

});


this.IsStaging = true;
StatusbarUi.Working('Starting...');
}

Expand All @@ -77,7 +79,6 @@ export class AppModel {
this.showPopUpMsg(`Server is not already running`);
return;
}
// this.Init();
LiveServerHelper.StopServer(this.LiveServerInstance, () => {
this.showPopUpMsg('Server is now offline.');
this.ToggleStatusBar();
Expand All @@ -93,20 +94,19 @@ export class AppModel {
if (isErrorMsg) {
window.showErrorMessage(msg);
}
else {
if (!Config.getDonotShowInfoMsg) {
const donotShowMsg = 'Don\'t show again';
window.showInformationMessage(msg, donotShowMsg)
.then((choise) => {
if (choise && choise === donotShowMsg) {
Config.setDonotShowInfoMsg = true;
}
});
}
else if (!Config.getDonotShowInfoMsg) {
const donotShowMsg = 'Don\'t show again';
window.showInformationMessage(msg, donotShowMsg)
.then(choise => {
if (choise && choise === donotShowMsg)
Config.setDonotShowInfoMsg(true);
});
}

}

private ToggleStatusBar() {
this.IsStaging = false;
if (!this.IsServerRunning) {
StatusbarUi.Offline(this.runningPort || Config.getPort);
}
Expand Down

0 comments on commit db07af5

Please sign in to comment.