-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
fs: add .ref() and .unref() methods to the StatWatcher and FSWatcher #33134
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -596,12 +596,47 @@ called previously. | |
| <!-- YAML | ||
| added: REPLACEME | ||
| --> | ||
|
|
||
| When called, the active `FSWatcher` object will not require the Node.js | ||
| event loop to remain active. If there is no other activity keeping the | ||
| event loop running, the process may exit before the `FSWatcher` object's | ||
| callback is invoked. Calling `watcher.unref()` multiple times will have | ||
| no effect. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These methods should probably also be documented for the return value of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, there are other methods like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
|
||
| ## Class: `fs.StatWatcher` | ||
| <!-- YAML | ||
| added: REPLACEME | ||
| --> | ||
|
|
||
| * Extends {EventEmitter} | ||
|
|
||
| A successful call to `fs.watchFile()` method will return a new `fs.StatWatcher` | ||
| object. | ||
|
|
||
| ### `watcher.ref()` | ||
| <!-- YAML | ||
| added: REPLACEME | ||
| --> | ||
|
|
||
| When called, requests that the Node.js event loop *not* exit so long as the | ||
| `StatWatcher` is active. Calling `watcher.ref()` multiple times will have | ||
| no effect. | ||
|
|
||
| By default, all `StatWatcher` objects are "ref'ed", making it normally | ||
| unnecessary to call `watcher.ref()` unless `watcher.unref()` had been | ||
| called previously. | ||
|
|
||
|
rickyes marked this conversation as resolved.
|
||
| ### `watcher.unref()` | ||
| <!-- YAML | ||
| added: REPLACEME | ||
| --> | ||
|
|
||
| When called, the active `StatWatcher` object will not require the Node.js | ||
| event loop to remain active. If there is no other activity keeping the | ||
| event loop running, the process may exit before the `StatWatcher` object's | ||
| callback is invoked. Calling `watcher.unref()` multiple times will have | ||
| no effect. | ||
|
|
||
| ## Class: `fs.ReadStream` | ||
| <!-- YAML | ||
| added: v0.1.93 | ||
|
|
@@ -3981,6 +4016,7 @@ changes: | |
| * `listener` {Function} | ||
| * `current` {fs.Stats} | ||
| * `previous` {fs.Stats} | ||
| * Returns: {fs.StatWatcher} | ||
|
|
||
| Watch for changes on `filename`. The callback `listener` will be called each | ||
| time the file is accessed. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.