Don't recreate the OSX Watcher class.

This commit is contained in:
Corey Johnson
2011-11-01 11:29:44 -07:00
parent 912654cddf
commit 6724c872d2

View File

@@ -3,10 +3,11 @@ class Watcher
@watchedPaths: {}
@setup: ->
__AAWatcher__ = OSX.JSCocoa.createClass_parentClass "__AAWatcher__", "NSObject"
OSX.JSCocoa.addInstanceMethod_class_jsFunction_encoding "watcher:receivedNotification:forPath:", __AAWatcher__, @watcher_receivedNotification_forPath, "v:@@@@"
if not OSX.__AAWatcher__
OSX.__AAWatcher__ = OSX.JSCocoa.createClass_parentClass "__AAWatcher__", "NSObject"
OSX.JSCocoa.addInstanceMethod_class_jsFunction_encoding "watcher:receivedNotification:forPath:", OSX.__AAWatcher__, @watcher_receivedNotification_forPath, "v:@@@@"
@delegate = __AAWatcher__.alloc.init
@delegate = OSX.__AAWatcher__.alloc.init
@queue = OSX.UKKQueue.alloc.init
@queue.setDelegate @delegate
@@ -28,7 +29,7 @@ class Watcher
@watchedPaths[path] = null
@queue.removePathFromQueue path
# Delegate method for AAWatcher
# Delegate method for __AAWatcher__
@watcher_receivedNotification_forPath = (queue, notification, path) =>
callbacks = @watchedPaths[path]