Browse Source

Fix timer behavior in autosaver

Steven Silvester 8 năm trước cách đây
mục cha
commit
69236b1d02
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  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);
   }
 
   /**