File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,13 @@ added: v0.5.8
329
329
330
330
Emitted when an error occurs while watching the file.
331
331
332
+ ### Event: 'close'
333
+ <!-- YAML
334
+ added: REPLACEME
335
+ -->
336
+
337
+ Emitted when the watcher stops watching for changes.
338
+
332
339
### watcher.close()
333
340
<!-- YAML
334
341
added: v0.5.8
Original file line number Diff line number Diff line change @@ -1387,8 +1387,13 @@ FSWatcher.prototype.close = function() {
1387
1387
return ;
1388
1388
}
1389
1389
this . _handle . close ( ) ;
1390
+ process . nextTick ( emitCloseNT , this ) ;
1390
1391
} ;
1391
1392
1393
+ function emitCloseNT ( self ) {
1394
+ self . emit ( 'close' ) ;
1395
+ }
1396
+
1392
1397
fs . watch = function ( filename , options , listener ) {
1393
1398
if ( typeof options === 'function' ) {
1394
1399
listener = options ;
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ for (const testCase of cases) {
54
54
}
55
55
assert . fail ( err ) ;
56
56
} ) ;
57
+ watcher . on ( 'close' , common . mustCall ( ) ) ;
57
58
watcher . on ( 'change' , common . mustCall ( function ( eventType , argFilename ) {
58
59
if ( interval ) {
59
60
clearInterval ( interval ) ;
You can’t perform that action at this time.
0 commit comments