diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html
index 626cbfd..a85de03 100644
--- a/src/app/webide/webide.component.html
+++ b/src/app/webide/webide.component.html
@@ -9,7 +9,7 @@
-
{ this.setButtonStateSaved(); });
- setInterval(() => { this.sendCodeIfDirty(); }, autosave_interval);
+ this.resetAutoSaveCountdown();
}
subscribeWS() {
@@ -79,6 +80,13 @@ export class WebideComponent implements OnInit {
this.saveButtonState = 'SAVED';
}
+ resetAutoSaveCountdown() {
+ if (this.autosave) {
+ clearInterval(this.autosave);
+ }
+ this.autosave = setInterval(() => { this.sendCodeIfDirty(); }, autosave_interval);
+ }
+
tabSwitchButtonHandler(file) {
if (this.saveButtonState === 'DIRTY') {
this.sendCodeContents();