diff --git a/dist/horizon-collection.html b/dist/horizon-collection.html
index 47ff30a..2302d7d 100644
--- a/dist/horizon-collection.html
+++ b/dist/horizon-collection.html
@@ -22,10 +22,29 @@
ready: function() {
var that = this
- horizon(this.name).watch().subscribe(function(messages){
- that.set("data", messages);
+ horizon(this.name).watch({rawChanges: true}).subscribe({
+ next: function(change) {
+ switch(change.type) {
+ case "initial":
+ case "add":
+ that.push('data', change.new_val)
+ break;
+ case "remove":
+ var index = that.data.findIndex(function(a){ return a.id == change.old_val.id});
+ if (index != -1) {
+ that.splice('data', index, 1);
+ }
+ break;
+ case "change":
+ var index = that.data.findIndex(function(a){ return a.id == change.old_val.id});
+ if (index != -1) {
+ that.set(`data.${index}`, change.new_val)
+ }
+ }
+ },
+ error: function(err) { console.error(`Error: ${err}`) }
});
-
+
},
insert: function(data) {
diff --git a/dist/todo-item.html b/dist/todo-item.html
index 95e4296..4dff465 100644
--- a/dist/todo-item.html
+++ b/dist/todo-item.html
@@ -145,7 +145,6 @@
},
detached: function() {
- this.playAnimation('exit');
this.removeEventListener('focus', this._activate.bind(this), true);
this.removeEventListener('blur', this._deactivate.bind(this), true);
this.removeEventListener('mouseenter', this._activate.bind(this));
@@ -178,7 +177,6 @@
}
},
_onCheck: function(){
- console.log("sda sd")
this.fire('update-todo', {todo: this.todo});
},
_onDelete: function() {