Implement automatic saving

This commit is contained in:
Kristóf Tóth 2018-03-02 13:49:00 +01:00
parent 5918b300ef
commit fc5a5b161b

View File

@ -48,6 +48,7 @@ export class WebideComponent implements OnInit {
this.requestCode();
this.processManagerService.init();
this.processManagerService.subscribeCallback('login', (event) => { this.setButtonStateSaved(); });
setInterval(() => { this.sendCodeIfDirty(); }, 10000);
}
subscribeWS() {
@ -99,6 +100,12 @@ export class WebideComponent implements OnInit {
this.processManagerService.restartProcess('login');
}
sendCodeIfDirty() {
if (this.saveButtonState === 'DIRTY') {
this.sendCodeContents();
}
}
sendCodeContents() {
this.webSocketService.send(this.key_id, {
'command': 'write',