mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-07-30 11:50:41 +08:00
Use socketio for syncing task changes across clients
This commit is contained in:
@@ -5,15 +5,30 @@ var app = app || {};
|
||||
app.ListView = Backbone.View.extend({
|
||||
|
||||
el: $("#main .children"),
|
||||
initialize: function(initialTasks) {
|
||||
this.collection = new app.List(initialTasks);
|
||||
this.render();
|
||||
|
||||
events: {
|
||||
'click #add': 'addTask'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.collection = new app.List();
|
||||
this.collection.fetch();
|
||||
this.render();
|
||||
|
||||
this.listenTo(this.collection, 'add', this.renderTask);
|
||||
},
|
||||
|
||||
addTask: function() {
|
||||
console.log('yes');
|
||||
//var view = new app.TaskView({model: task})
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.collection.each(function(task) {
|
||||
this.renderTask(task);
|
||||
}, this);
|
||||
},
|
||||
|
||||
renderTask: function(task) {
|
||||
var taskView = new app.TaskView({
|
||||
model: task
|
||||
|
||||
Reference in New Issue
Block a user