Skip to content

Commit 1b53d15

Browse files
committed
v0.0.8 - __startWatch will check if already watching
1 parent 9fb8be4 commit 1b53d15

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/pointer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Pointer(obj) {
2222
var name = path.basename(obj.filePath);
2323
var ext = path.extname(name);
2424
ext = ext.charAt(0) === '.' ? ext.substr(1) : '';
25-
var _path = path.resolve(obj.filePath);
25+
var _path = path.resolve(obj.filePath);
2626

2727
Object.defineProperties(self, {
2828
// Pointer to parent if one exists
@@ -49,7 +49,7 @@ function Pointer(obj) {
4949
// file or directory
5050
_type: {
5151
get: function() { return type; },
52-
set: function(v) { type = v; },
52+
set: function(v) { type = v; },
5353
configurable: true
5454
},
5555
// Cached stats
@@ -135,13 +135,16 @@ function Pointer(obj) {
135135
value: function () {
136136
if (watcher) {
137137
watcher.close();
138+
watcher = null;
138139
}
139140
}
140141
},
141142
// Start watching file changes
142143
__startWatch: {
143144
value: function () {
144-
forwardEvents(fs.watch(self._path, {persistent: false}));
145+
if (!watcher) {
146+
forwardEvents(fs.watch(self._path, {persistent: false}));
147+
}
145148
}
146149
}
147150
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"files",
88
"pointer"
99
],
10-
"version": "0.0.7",
10+
"version": "0.0.8",
1111
"repository": {
1212
"type": "git",
1313
"url": "git@github.com:DeadAlready/node-file-pointer"

0 commit comments

Comments
 (0)