Refactor setButtonState family of callbacks

This commit is contained in:
Kristóf Tóth 2018-03-02 15:48:45 +01:00
parent 3266854db8
commit 3cfcf8fddc
2 changed files with 6 additions and 10 deletions

View File

@ -9,7 +9,7 @@
</button>
</div>
<div (keypress)="setSaveButtonStateDirty(); setDeployButtonStateTodeploy(); resetAutoSaveCountdown()"
<div (keypress)="setSaveButtonState('DIRTY'); setDeployButtonState('TODEPLOY'); resetAutoSaveCountdown()"
ace-editor
[(text)]="code"
[mode]="language"

View File

@ -50,7 +50,7 @@ export class WebideComponent implements OnInit {
this.subscribeWS();
this.requestCode();
this.processManagerService.init();
this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonStateDeployed(); });
this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonState('DEPLOYED'); });
this.resetAutoSaveCountdown();
}
@ -100,16 +100,12 @@ export class WebideComponent implements OnInit {
this.requestCode();
}
setSaveButtonStateDirty() {
this.saveButtonState = 'DIRTY';
setSaveButtonState(state: string) {
this.saveButtonState = state;
}
setDeployButtonStateDeployed() {
this.deployButtonState = 'DEPLOYED';
}
setDeployButtonStateTodeploy() {
this.deployButtonState = 'TODEPLOY';
setDeployButtonState(state: string) {
this.deployButtonState = state;
}
deployCode() {