Index: example/todomvc/web/model.dart |
diff --git a/example/todomvc/web/model.dart b/example/todomvc/web/model.dart |
index 9ba558cab0d49dc2e85362daffa86162586c4330..c3878fd1e561ca25a12de879d7a811768df362b6 100644 |
--- a/example/todomvc/web/model.dart |
+++ b/example/todomvc/web/model.dart |
@@ -4,7 +4,6 @@ |
library model; |
-import 'dart:html' show CompoundBinding; |
import 'package:polymer/polymer.dart'; |
final appModel = new AppModel._(); |
@@ -14,26 +13,25 @@ class AppModel extends ObservableBase { |
@observable int doneCount; |
@observable int remaining; |
@observable List<Todo> visibleTodos; |
- @observable bool hasTodos; |
@observable bool hasCompleteTodos; |
bool _allChecked; |
AppModel._() { |
- // TODO(jmesserly): need to make this easier. |
new ListPathObserver(todos, 'done').changes.listen(_updateTodoDone); |
windowLocation.changes.listen(_updateVisibleTodos); |
_updateTodoDone(null); |
} |
_updateTodoDone(_) { |
+ // TODO(jmesserly): we should try using fancy-syntax expressions and filters |
+ // instead of computing so many things. |
doneCount = todos.fold(0, (count, t) => count + (t.done ? 1 : 0)); |
hasCompleteTodos = doneCount > 0; |
remaining = todos.length - doneCount; |
- hasTodos = todos.length > 0; |
_allChecked = notifyPropertyChange(const Symbol('allChecked'), |
- _allChecked, hasTodos && remaining == 0); |
+ _allChecked, todos.length > 0 && remaining == 0); |
_updateVisibleTodos(_); |
} |