add $native.unwatch(path, id)

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-04-25 18:03:51 -07:00
parent 54d869c52e
commit 3ac49e1cd5
6 changed files with 83 additions and 27 deletions

View File

@@ -27,10 +27,10 @@ class Directory
@unsubscribeFromNativeChangeEvents() if @subscriptionCount() == 0
subscribeToNativeChangeEvents: ->
$native.watchPath @path, (eventTypes) =>
@watchId = $native.watchPath @path, (eventTypes) =>
@trigger 'contents-change' if eventTypes.modified?
unsubscribeFromNativeChangeEvents: ->
$native.unwatchPath(@path)
$native.unwatchPath(@path, @watchId)
_.extend Directory.prototype, EventEmitter