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
h2 projects list
each project in items
Item(item=project)
each project, index in items
Item(item=project, key=project.name)

View File

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