Browse files

Moved name def so it follows new add()'s

  • Loading branch information...
1 parent b612931 commit 51e6719b80ee597692deac5ab71a86020d3510a4 @Qard committed Jan 26, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/index.js
View
14 lib/index.js
@@ -65,9 +65,13 @@ Crsh.prototype.add = function (f) {
coffee = require('coffee-script')
}
+ // Add to list and rebuild name
this.list.push(f)
this.name = 'crsh-' + helper.md5(this.list.join(',')) + '.js'
+
+ // Add to watcher
this.watcher && this.watcher.add(f)
+
return this
}
@@ -80,9 +84,17 @@ Crsh.prototype.add = function (f) {
*/
Crsh.prototype.remove = function (f) {
f = helper.realPath(f, this.path)
+
+ // Remove from list and rebuild name
var p = this.list.indexOf(f)
- if (p > -1) { this.list.splice(p, 1) }
+ if (p > -1) {
+ this.list.splice(p, 1)
+ }
+ this.name = 'crsh-' + helper.md5(this.list.join(',')) + '.js'
+
+ // Remove from watcher
this.watcher && this.watcher.remove(f)
+
return this
}

0 comments on commit 51e6719

Please sign in to comment.