-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: clarify 'change' in fs.watch and FSWatcher #7506
doc: clarify 'change' in fs.watch and FSWatcher #7506
Conversation
fa01cd6
to
15b5ae1
Compare
@@ -1447,6 +1453,9 @@ The listener callback gets two arguments `(event, filename)`. `event` is either | |||
`'rename'` or `'change'`, and `filename` is the name of the file which triggered | |||
the event. | |||
|
|||
Please note the listener callback is attached to the `'change'` event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the actual confusion in the original issue, is because of the previous paragraph. IINW, OP misunderstood the type of event (rename
and change
) as the actual events emitted. Perhaps we can change/explain the parameter event
.
Thoughts @Trott?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thefourtheye I could change the name in both the code and docs to eventType
or something like that - it's just a change of identifier name so it wouldn't be intrusive/breaking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing event
to eventType
would be a significant improvement.
/cc @nodejs/documentation |
The name 'event' for the argument of the listener in fs.watch was confusing considering FSWatcher also had events. This changes the name of the argument to eventType. Fixes: nodejs#7504 PR-URL: nodejs#7506
15b5ae1
to
ba23cf9
Compare
I've changed |
|
LGTM. CI Run: https://ci.nodejs.org/job/node-test-pull-request/3166/ |
@nodejs/documentation any comments on the PR as it is now? |
@Trott do you object to merging this for now? I think it's an improvement to the current situation, we can expect further copyedit PRs to improve on the doc part. I can also limit the change to just event -> eventType |
@claudiorodriguez No objection from me! |
Landed in 6e15ae9 |
The name 'event' for the argument of the listener in fs.watch was confusing considering FSWatcher also had events. This changes the name of the argument to eventType. Fixes: #7504 PR-URL: #7506 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
The name 'event' for the argument of the listener in fs.watch was confusing considering FSWatcher also had events. This changes the name of the argument to eventType. Fixes: #7504 PR-URL: #7506 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
The name 'event' for the argument of the listener in fs.watch was confusing considering FSWatcher also had events. This changes the name of the argument to eventType. Fixes: #7504 PR-URL: #7506 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@claudiorodriguez thanks for adding the tag. Unfortunately this relies on some changes that have not yet landed. Please feel free to manually backport and open a PR |
Checklist
Affected core subsystem(s)
doc
Description of change
The 'change' event can refer to either the value of 'event'
in the fs.watch listener, and to an FSWatcher actual event.
This adds some clarification.
Fixes: #7504