Comparing version 0.0.19 to 0.0.20
@@ -242,3 +242,3 @@ // Generated by CoffeeScript 1.6.2 | ||
if (this._resetting) { | ||
if (this._resetting || item.removed) { | ||
return; | ||
@@ -258,4 +258,8 @@ } | ||
Collection.prototype._persistInsert = function(item) { | ||
var request; | ||
var request, | ||
_this = this; | ||
item.once("remove", function() { | ||
return _this.splice(_this.indexOf(item), 1); | ||
}); | ||
if (this._resetting) { | ||
@@ -262,0 +266,0 @@ return; |
@@ -241,2 +241,4 @@ // Generated by CoffeeScript 1.6.2 | ||
LinenModel.prototype.remove = function(next) { | ||
var _this = this; | ||
if (next == null) { | ||
@@ -251,3 +253,8 @@ next = (function() {}); | ||
method: "DELETE" | ||
}, next); | ||
}, outcome.e(next).s(function() { | ||
_this.removed = true; | ||
_this.emit("remove"); | ||
_this.dispose(); | ||
return next(); | ||
})); | ||
return this; | ||
@@ -254,0 +261,0 @@ }; |
{ | ||
"name": "linen", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "```javascript", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -133,2 +133,4 @@ | ||
it("can successfuly remove a friend", function(next) { | ||
@@ -238,2 +240,14 @@ var lastFriend = items.craigsFriends.last(), | ||
var peopleCount = 0; | ||
it("can remove a person from the model", function(next) { | ||
peopleCount = items.people.length() | ||
items.kramer.remove(next); | ||
}); | ||
it("kramer doesn't exist in the people's collection", function() { | ||
expect(items.people.indexOf(items.kramer)).to.be(-1); | ||
expect(items.people.length()).to.be(peopleCount - 1) | ||
}); | ||
return; | ||
@@ -240,0 +254,0 @@ |
@@ -146,3 +146,8 @@ | ||
person.friends.splice(friendIndex, 1); | ||
vine.result(getPerson({ params: { person: req.params.friend }})) | ||
res.end(vine.result(getPerson({ params: { person: req.params.friend }}))) | ||
}, | ||
"pull -method=DELETE people/:person": function(req, res) { | ||
var person = getPerson(req); | ||
collections.people.splice(collections.people.indexOf(person), 1); | ||
res.end(vine.result(person)); | ||
} | ||
@@ -149,0 +154,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
53105
1243