Commit 896810e1 authored by Dale Harvey's avatar Dale Harvey

Close GH-776: Make sure updateCount works with async Stores

parent fe2f9ba0
......@@ -199,16 +199,16 @@
* number of todos.
*/
Controller.prototype._updateCount = function () {
var todos = this.model.getCount();
this.view.render('updateElementCount', todos.active);
this.view.render('clearCompletedButton', {
completed: todos.completed,
visible: todos.completed > 0
});
this.model.getCount((function(todos) {
this.view.render('updateElementCount', todos.active);
this.view.render('clearCompletedButton', {
completed: todos.completed,
visible: todos.completed > 0
});
this.view.render('toggleAll', {checked: todos.completed === todos.total});
this.view.render('contentBlockVisibility', {visible: todos.total > 0});
this.view.render('toggleAll', {checked: todos.completed === todos.total});
this.view.render('contentBlockVisibility', {visible: todos.total > 0});
}).bind(this);
};
/**
......
......@@ -93,7 +93,7 @@
/**
* Returns a count of all todos
*/
Model.prototype.getCount = function () {
Model.prototype.getCount = function (callback) {
var todos = {
active: 0,
completed: 0,
......@@ -110,9 +110,8 @@
todos.total++;
});
callback(todos);
});
return todos;
};
// Export to window
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment