Comparing version 0.2.5 to 0.2.6
@@ -0,1 +1,4 @@ | ||
# Chokidar 0.2.6 (June 8, 2012) | ||
* Prevented creating of duplicate 'add' events. | ||
# Chokidar 0.2.5 (June 8, 2012) | ||
@@ -2,0 +5,0 @@ * Fixed a bug when new files in new directories hadn't been added. |
@@ -21,5 +21,5 @@ 'use strict'; | ||
function FSWatcher(options) { | ||
this.options = options = options != null ? options : {}; | ||
this.options = options = options != null ? options : Object.create(null); | ||
this._handle = this._handle.bind(this); | ||
this.watched = {}; | ||
this.watched = Object.create(null); | ||
this.watchers = []; | ||
@@ -102,3 +102,3 @@ if (this.options.persistent == null) { | ||
// Returns nothing. | ||
FSWatcher.prototype._watch = function(item, callback) { | ||
FSWatcher.prototype._watch = function(item, itemType, callback) { | ||
var _this = this; | ||
@@ -110,2 +110,3 @@ var options, watcher; | ||
var parent = this._getWatchedDir(directory); | ||
// Prevent memory leaks. | ||
@@ -134,2 +135,3 @@ if (parent.indexOf(basename) >= 0) return; | ||
} | ||
if (itemType === 'file') _this.emit('add', item); | ||
}; | ||
@@ -145,6 +147,5 @@ | ||
var _this = this; | ||
this._watch(file, function(file) { | ||
_this._watch(file, 'file', function(file) { | ||
_this.emit('change', file); | ||
}); | ||
this.emit('add', file); | ||
}; | ||
@@ -191,3 +192,3 @@ | ||
read(directory); | ||
this._watch(directory, read); | ||
this._watch(directory, 'directory', read); | ||
}; | ||
@@ -244,3 +245,3 @@ | ||
}); | ||
this.watched = {}; | ||
this.watched = Object.create(null); | ||
return this; | ||
@@ -247,0 +248,0 @@ }; |
{ | ||
"name": "chokidar", | ||
"description": "A neat wrapper around node.js fs.watch / fs.watchFile.", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"keywords": ["fs", "watch", "watchFile", "watcher", "file"], | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/paulmillr/chokidar", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12222