refactor events and add unqi key

This commit is contained in:
Vladimir Polyakov 2015-05-04 23:50:02 +03:00
parent a1951016a9
commit 99c7dada7b
2 changed files with 4 additions and 7 deletions

View File

@ -1,4 +1,4 @@
div div
h2 projects list h2 projects list
each project in items each project, index in items
Item(item=project) Item(item=project, key=project.name)

View File

@ -5,15 +5,12 @@ define([
], function(Reflux, ProjectActions, resources) { ], function(Reflux, ProjectActions, resources) {
var Store = Reflux.createStore({ var Store = Reflux.createStore({
init: function() { init: function() {
this.listenTo(ProjectActions.load, this.load);
this.listenTo(ProjectActions.readAll, this.readAll); this.listenTo(ProjectActions.readAll, this.readAll);
}, },
load: function(items) {
this.trigger(items);
},
readAll: function() { readAll: function() {
var self = this;
resources.projects.sync('read', function(err, projects) { resources.projects.sync('read', function(err, projects) {
ProjectActions.load(projects) self.trigger(projects);
}); });
} }
}); });