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();