Skip to content

Commit

Permalink
Updated to WatchmanWatcher, created singleton WatchmanClient using pr…
Browse files Browse the repository at this point in the history
…omises (#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)
  • Loading branch information
dcombslinkedin authored and stefanpenner committed Feb 6, 2018
1 parent d9158e9 commit cd7d33d
Show file tree
Hide file tree
Showing 3 changed files with 588 additions and 171 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ maintains the same API across all modes and will be easy to switch.

### sane(dir, options)

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

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

0 comments on commit cd7d33d

Please sign in to comment.