Added unwatchFile method for issue-551
This commit is contained in:
parent
7c16490e25
commit
db315eae13
|
@ -17,6 +17,7 @@ var providers = require('../providers/index.js');
|
||||||
var Shell = require('../shell/shell.js');
|
var Shell = require('../shell/shell.js');
|
||||||
var Intercom = require('../../lib/intercom.js');
|
var Intercom = require('../../lib/intercom.js');
|
||||||
var FSWatcher = require('../fs-watcher.js');
|
var FSWatcher = require('../fs-watcher.js');
|
||||||
|
//var unwatcher = require('../unwatcherFile.js');
|
||||||
var Errors = require('../errors.js');
|
var Errors = require('../errors.js');
|
||||||
var defaultGuidFn = require('../shared.js').guid;
|
var defaultGuidFn = require('../shared.js').guid;
|
||||||
|
|
||||||
|
@ -159,6 +160,27 @@ function FileSystem(options, callback) {
|
||||||
return watcher;
|
return watcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.unwatchFile = function(filename, listener) {
|
||||||
|
if(isNullPath(filename)) {
|
||||||
|
throw new Error('Path must be a string without null bytes.');
|
||||||
|
}
|
||||||
|
listener = listener || nop;
|
||||||
|
|
||||||
|
if(listener == nop){
|
||||||
|
this.removeAllListeners();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.off('change', listener);
|
||||||
|
}
|
||||||
|
/*var unwatch = new unwatchFile();
|
||||||
|
if(listener == nop){
|
||||||
|
unwatch.removeListeners();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
unwatch.removeSingleListener(listener);
|
||||||
|
}*/
|
||||||
|
};
|
||||||
|
|
||||||
// Deal with various approaches to node ID creation
|
// Deal with various approaches to node ID creation
|
||||||
function wrappedGuidFn(context) {
|
function wrappedGuidFn(context) {
|
||||||
return function(callback) {
|
return function(callback) {
|
||||||
|
|
Loading…
Reference in New Issue