Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
redmunds committed Jul 10, 2012
1 parent 59e40a9 commit 27b1b49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/document/ChangedDocumentTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@ define(function (require, exports, module) {
$(DocumentManager).on("afterDocumentCreate", function (event, doc) {
// Only track documents in the current project
if (ProjectManager.isWithinProject(doc.file.fullPath)) {
self._addListener(doc);
self._addListener(doc);
}
});

$(DocumentManager).on("beforeDocumentDelete", function (event, doc) {
// Only documents in the current project are tracked
if (ProjectManager.isWithinProject(doc.file.fullPath)) {
self._removeListener(doc);
}
// In case a document somehow remains loaded after its project
// has been closed, unconditionally attempt to remove the listener.
self._removeListener(doc);
});

$(window).focus(this._onWindowFocus);
Expand All @@ -80,7 +79,7 @@ define(function (require, exports, module) {
* @private
*/
ChangedDocumentTracker.prototype._removeListener = function (doc) {
$(doc).off("change", self._onChange);
$(doc).off("change", this._onChange);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/document/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ define(function (require, exports, module) {

// Initialize the active editor
if (!activeFile && _workingSet.length > 0) {
activeFile = _workingSet[0];
activeFile = _workingSet[0].fullPath;
}

if (activeFile) {
Expand Down

0 comments on commit 27b1b49

Please sign in to comment.