@@ -94,6 +94,14 @@ define(function (require, exports, module) {
9494 ProjectManager = require ( "project/ProjectManager" ) ,
9595 Strings = require ( "strings" ) ;
9696
97+ const EVENT_AFTER_DOCUMENT_CREATE = "afterDocumentCreate" ,
98+ EVENT_PATH_DELETED = "pathDeleted" ,
99+ EVENT_FILE_NAME_CHANGE = "fileNameChange" ,
100+ EVENT_BEFORE_DOCUMENT_DELETE = "beforeDocumentDelete" ,
101+ EVENT_DOCUMENT_REFRESHED = "documentRefreshed" ,
102+ EVENT_DOCUMENT_CHANGE = "documentChange" ,
103+ EVENT_DIRTY_FLAG_CHANGED = "dirtyFlagChange" ;
104+
97105
98106 /**
99107 * @private
@@ -472,7 +480,7 @@ define(function (require, exports, module) {
472480 */
473481 function notifyFileDeleted ( file ) {
474482 // Notify all editors to close as well
475- exports . trigger ( "pathDeleted" , file . fullPath ) ;
483+ exports . trigger ( EVENT_PATH_DELETED , file . fullPath ) ;
476484
477485 var doc = getOpenDocumentForPath ( file . fullPath ) ;
478486
@@ -515,7 +523,7 @@ define(function (require, exports, module) {
515523 // For images not open in the workingset,
516524 // FileSyncManager.syncOpenDocuments() will
517525 // not tell us to close those views
518- exports . trigger ( "pathDeleted" , fullPath ) ;
526+ exports . trigger ( EVENT_PATH_DELETED , fullPath ) ;
519527 }
520528 }
521529
@@ -536,7 +544,7 @@ define(function (require, exports, module) {
536544 } ) ;
537545
538546 // Send a "fileNameChange" event. This will trigger the views to update.
539- exports . trigger ( "fileNameChange" , oldName , newName ) ;
547+ exports . trigger ( EVENT_FILE_NAME_CHANGE , oldName , newName ) ;
540548 }
541549
542550
@@ -578,25 +586,27 @@ define(function (require, exports, module) {
578586 }
579587
580588 _openDocuments [ doc . file . id ] = doc ;
581- exports . trigger ( "afterDocumentCreate" , doc ) ;
589+ exports . trigger ( EVENT_AFTER_DOCUMENT_CREATE , doc ) ;
582590 } )
583591 . on ( "_beforeDocumentDelete" , function ( event , doc ) {
584592 if ( ! _openDocuments [ doc . file . id ] ) {
585593 console . error ( "Document with references was not in _openDocuments!" ) ;
586594 return true ;
587595 }
588596
589- exports . trigger ( "beforeDocumentDelete" , doc ) ;
597+ exports . trigger ( EVENT_BEFORE_DOCUMENT_DELETE , doc ) ;
590598 delete _openDocuments [ doc . file . id ] ;
591599 } )
592600 . on ( "_documentRefreshed" , function ( event , doc ) {
593- exports . trigger ( "documentRefreshed" , doc ) ;
601+ exports . trigger ( EVENT_DOCUMENT_REFRESHED , doc ) ;
602+ } ) . on ( EVENT_DOCUMENT_CHANGE , function ( event , doc , changelist ) {
603+ exports . trigger ( EVENT_DOCUMENT_CHANGE , doc , changelist ) ;
594604 } )
595605 . on ( "_dirtyFlagChange" , function ( event , doc ) {
596606 // Modules listening on the doc instance notified about dirtyflag change
597607 // To be used internally by Editor
598608 doc . trigger ( "_dirtyFlagChange" , doc ) ;
599- exports . trigger ( "dirtyFlagChange" , doc ) ;
609+ exports . trigger ( EVENT_DIRTY_FLAG_CHANGED , doc ) ;
600610 if ( doc . isDirty ) {
601611 MainViewManager . addToWorkingSet ( MainViewManager . ACTIVE_PANE , doc . file ) ;
602612
0 commit comments