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
329329
330330Emitted when an error occurs while watching the file.
331331
332+ ### Event: 'close'
333+ <!-- YAML
334+ added: REPLACEME
335+ -->
336+
337+ Emitted when the watcher stops watching for changes.
338+
332339### watcher.close()
333340<!-- YAML
334341added: v0.5.8
Original file line number Diff line number Diff line change @@ -1387,8 +1387,13 @@ FSWatcher.prototype.close = function() {
13871387 return ;
13881388 }
13891389 this . _handle . close ( ) ;
1390+ process . nextTick ( emitCloseNT , this ) ;
13901391} ;
13911392
1393+ function emitCloseNT ( self ) {
1394+ self . emit ( 'close' ) ;
1395+ }
1396+
13921397fs . watch = function ( filename , options , listener ) {
13931398 if ( typeof options === 'function' ) {
13941399 listener = options ;
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ for (const testCase of cases) {
5454 }
5555 assert . fail ( err ) ;
5656 } ) ;
57+ watcher . on ( 'close' , common . mustCall ( ) ) ;
5758 watcher . on ( 'change' , common . mustCall ( function ( eventType , argFilename ) {
5859 if ( interval ) {
5960 clearInterval ( interval ) ;
You can’t perform that action at this time.
0 commit comments