Emit {will,did}SavePath on ipcMain before/after a buffer is saved

This commit is contained in:
Antonio Scandurra
2016-05-23 18:37:26 +02:00
parent 720ad9c0b4
commit ef3ab03d28
5 changed files with 33 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ class Project extends Model
Section: Construction and Destruction
###
constructor: ({@notificationManager, packageManager, config}) ->
constructor: ({@notificationManager, packageManager, config, @applicationDelegate}) ->
@emitter = new Emitter
@buffers = []
@paths = []
@@ -390,6 +390,8 @@ class Project extends Model
@on 'buffer-created', (buffer) -> callback(buffer)
subscribeToBuffer: (buffer) ->
buffer.onWillSave ({path}) => @applicationDelegate.emitWillSavePath(path)
buffer.onDidSave ({path}) => @applicationDelegate.emitDidSavePath(path)
buffer.onDidDestroy => @removeBuffer(buffer)
buffer.onDidChangePath =>
unless @getPaths().length > 0