Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: example/todomvc/web/model.dart

Issue 22962005: Merge pull request #581 from kevmoo/polymer (Closed) Base URL: https://github.com/dart-lang/web-ui.git@polymer
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « example/todomvc/web/editable_label.html ('k') | example/todomvc/web/todo_row.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(_);
}
« no previous file with comments | « example/todomvc/web/editable_label.html ('k') | example/todomvc/web/todo_row.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698