src/document/ChangedDocumentTracker.js
function ChangedDocumentTracker() {
        var self = this;

        this._changedPaths = {};
        this._windowFocus = true;
        this._addListener = this._addListener.bind(this);
        this._removeListener = this._removeListener.bind(this);
        this._onChange = this._onChange.bind(this);
        this._onWindowFocus = this._onWindowFocus.bind(this);

        DocumentManager.on("afterDocumentCreate", function (event, doc) {
            // Only track documents in the current project
            if (ProjectManager.isWithinProject(doc.file.fullPath)) {
                self._addListener(doc);
            }
        });

        DocumentManager.on("beforeDocumentDelete", function (event, 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);
    }
function ChangedDocumentTracker() {
        var self = this;

        this._changedPaths = {};
        this._windowFocus = true;
        this._addListener = this._addListener.bind(this);
        this._removeListener = this._removeListener.bind(this);
        this._onChange = this._onChange.bind(this);
        this._onWindowFocus = this._onWindowFocus.bind(this);

        DocumentManager.on("afterDocumentCreate", function (event, doc) {
            // Only track documents in the current project
            if (ProjectManager.isWithinProject(doc.file.fullPath)) {
                self._addListener(doc);
            }
        });

        DocumentManager.on("beforeDocumentDelete", function (event, 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);
    }
function ChangedDocumentTracker ( ) { var self = this ; this . _changedPaths = { } ; this . _windowFocus = true ; this . _addListener = this . _addListener . bind ( this ) ; this . _removeListener = this . _removeListener . bind ( this ) ; this . _onChange = this . _onChange . bind ( this ) ; this . _onWindowFocus = this . _onWindowFocus . bind ( this ) ; DocumentManager . on ( "afterDocumentCreate" , function ( event , doc ) { // Only track documents in the current project if ( ProjectManager . isWithinProject ( doc . file . fullPath ) ) { self . _addListener ( doc ) ; } } ) ; DocumentManager . on ( "beforeDocumentDelete" , function ( event , 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 ) ; }
Tracks "change" events on opened Documents. Used to monitor changes
to documents in-memory and update caches. Assumes all documents have
changed when the Brackets window loses and regains focus. Does not
read timestamps of files on disk. Clients may optionally track file
timestamps on disk independently.
@constructor
Tracks change events on opened Documents . Used to monitor changes to documents in - memory and update caches . Assumes all documents have changed when the Brackets window loses and regains focus . Does not read timestamps of files on disk . Clients may optionally track file timestamps on disk independently .