Explorar o código

Fix timer behavior in autosaver

Steven Silvester %!s(int64=8) %!d(string=hai) anos
pai
achega
69236b1d02
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/docmanager/savehandler.ts

+ 3 - 2
src/docmanager/savehandler.ts

@@ -62,7 +62,6 @@ class SaveHandler implements IDisposable {
       return;
     }
     clearTimeout(this._autosaveTimer);
-    this._stopped = true;
     this._context = null;
     clearSignalData(this);
   }
@@ -91,7 +90,9 @@ class SaveHandler implements IDisposable {
     if (this._stopped) {
       return;
     }
-    setTimeout(() => this._save(), this._interval * 1000);
+    this._autosaveTimer = setTimeout(() => {
+      this._save();
+    }, this._interval * 1000);
   }
 
   /**