File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,8 +8,11 @@ var source = require('source');
88
99exports = module . exports = function ( opts ) {
1010 var modified = new Date ( ) ;
11- var ee = opts . listen = new EventEmitter ;
11+
12+ if ( ! opts . hasOwnProperty ( 'watch' ) ) opts . watch = true ;
13+ var ee = opts . listen = opts . listen || new EventEmitter ;
1214 var listening = false ;
15+
1316 var srcCache = exports . bundle ( opts ) ;
1417
1518 return function ( req , res , next ) {
@@ -346,19 +349,19 @@ function unext (s) {
346349
347350var watchedFiles = [ ] ;
348351function fileWatch ( file , opts ) {
349- if ( opts . hasOwnProperty ( 'watch' ) && ! opts . watch ) return ;
352+ if ( ! opts . watch ) return ;
350353
351354 if ( opts . listen ) opts . listen . on ( 'close' , function ( ) {
352355 fs . unwatchFile ( file ) ;
353356 } ) ;
354357
355358 watchedFiles . push ( file ) ;
356359 var wopts = {
357- persistent : opts . watch && opts . watch . hasOwnProperty ( 'persistent' )
360+ persistent : opts . watch . hasOwnProperty ( 'persistent' )
358361 ? opts . watch . persistent
359362 : true
360363 ,
361- interval : opts . watch && opts . watch . interval || 500 ,
364+ interval : opts . watch . interval || 500 ,
362365 } ;
363366
364367 fs . watchFile ( file , wopts , function ( curr , prev ) {
You can’t perform that action at this time.
0 commit comments