Skip to content

Commit cd7d33d

Browse files
dcombslinkedinstefanpenner
authored andcommitted
Updated to WatchmanWatcher, created singleton WatchmanClient using promises (#109)
* minor typo fixes * created singleton WatchmanClient, uses promises. Updated WatchmanWatcher to use it instead of direct connection to watchman.Client. Also made WatchmanClient call know WW APIs, instead of trying to handle with EventEmitter. * minor typo fix, removed test code to force call to WC.onEnd for testing reconnect * updated to new code style based on PR feedback from Stef * further updates based on Stef comments * created _watcherMap using Object.create() * fixed up watchman_client to support multiple binary paths, added getInstance(), reworked the client setup mechanism to avoid possible race conditions, cleaned WatchmanWatcher to style standard that Stef Penner mentioned * moved backoffTimes to a function so we can have one obj per watchmanBinaryPath (i.e. WatchmanClient). Also added try/catch in _handleClientAndCheck in case return value from capabilityCheck is somehow malformed or attaching listeners to watchman.Client does not work * removed catch from promise chain, so callers will be responsible for the rejected promise (which they should be anyway)
1 parent d9158e9 commit cd7d33d

File tree

3 files changed

+588
-171
lines changed

3 files changed

+588
-171
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ maintains the same API across all modes and will be easy to switch.
3434

3535
### sane(dir, options)
3636

37-
Watches a directory and all it's descendant directories for changes, deletions, and additions on files and directories.
37+
Watches a directory and all its descendant directories for changes, deletions, and additions on files and directories.
3838

3939
```js
4040
var watcher = sane('path/to/dir', {glob: ['**/*.js', '**/*.css']});

0 commit comments

Comments
 (0)