From 635d83e1b36f467bfe694adc02a9b4568575036f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 30 Mar 2018 23:04:31 +0200 Subject: [PATCH] Readd resetAutoSaveCountDown for more deterministic saving ops --- src/app/webide/webide.component.html | 2 +- src/app/webide/webide.component.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html index bccf916..937d2c1 100644 --- a/src/app/webide/webide.component.html +++ b/src/app/webide/webide.component.html @@ -34,7 +34,7 @@ -
{ this.setDeployButtonState('DEPLOYED'); }); this.processManagerService.subscribeErrorCallback(config.webide.deployProcessName, (event) => { this.setDeployButtonState('FAILED'); }); - setInterval(() => { this.sendCodeIfDirty(); }, config.webide.autoSaveInterval); + this.resetAutoSaveCountdown(); } subscribeWS() { @@ -95,6 +95,13 @@ export class WebideComponent implements OnInit { this.updateFileData(data); } + resetAutoSaveCountdown() { + if (this.autosave) { + clearInterval(this.autosave); + } + this.autosave = setInterval(() => { this.sendCodeIfDirty(); }, config.webide.autoSaveInterval); + } + tabSwitchButtonHandler(file) { if (this.codeState === 'DIRTY') { this.sendCodeContents();