Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'ready' event #72

Merged
merged 3 commits into from
Dec 30, 2018
Merged

Add a 'ready' event #72

merged 3 commits into from
Dec 30, 2018

Conversation

Krinkle
Copy link
Contributor

@Krinkle Krinkle commented Dec 28, 2018

Fixes #71.

hasDup:
Only called in getMessages() with result of Array#some,
which makes an array.

unique:
Called in getMessages() with result of Array#filter,
which makes an array.
Called in watch() with a value that passed is.array() check.

composeMessage:
Called makeArray() on `names`, which is a private array that
cannot be replaced by user code.
fs.readdir() either gives an error, or an array of values.
Other outcomes are not possible.

If we want to support that possibility, perhaps there should be
another `if` with `throw new Error('invalid fs.readdir value');`.
But, instead, I think maybe it should be removed.
@Krinkle Krinkle changed the title add a 'ready' event Add a 'ready' event Dec 28, 2018
This is fires once the watchers are created.

* For single files,
  this happens immediately.

* For directories on macOS/Windows (recursive, and non-recursive)
  this happens after hasNativeRecursive() callback.

* For directories on Linux (non-recursive)
  this happens after hasNativeRecursive() callback.

* For directories on Linux (recursive)
  this happens after hasNativeRecursive() callback and after
  each recursive call to watchDirectory() via getSubDirectories()
  is completed. To keep track of this, use a counting semaphore.

Fixes yuanchuan#71
@yuanchuan yuanchuan merged commit aa9e563 into yuanchuan:master Dec 30, 2018
@Krinkle Krinkle deleted the ready-event branch December 30, 2018 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants