Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Also pause the watcher on deletions to avoid triggering more than one…
Browse files Browse the repository at this point in the history
… warning dialog.
  • Loading branch information
darahak committed Dec 28, 2016
1 parent 8186b50 commit 38d8d71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/renderer/abr-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ AbrDocument.prototype = {
that.startWatcher();
});
} else {
// The previous document is dropped from the editor.
// The watcher will resume on save.
that.setDirty();
that.updateWindowTitle();
}
Expand All @@ -399,19 +401,22 @@ AbrDocument.prototype = {
if (keepFile) {
that.setDirty();
that.updateWindowTitle();
that.startWatcher();
} else {
that.pauseWatcher();
that.clear();
}
});
}
};
this.watcher = files.createWatcher(this.path, {
change: function (path) {
// Pause the watcher to avoid triggering multiple warning dialogs
// while the first one is being handled.
that.pauseWatcher();
runOnFocus(handleAsyncFileChange, path);
},
unlink: function (path) {
that.pauseWatcher();
runOnFocus(handleAsyncFileChange, path);
},
error: function (err) {
Expand Down

0 comments on commit 38d8d71

Please # to comment.