diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index a8ea14f..3fe10a5 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -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',