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

Side by Side Diff: example/todomvc/web/app.dart

Issue 19497002: Reducing the amount of code we generate in the compiler: We still continue (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library app; 5 library app;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:observe/observe.dart'; 8 import 'package:observe/observe.dart';
9 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
10 import 'model.dart'; 10 import 'model.dart';
11 11
12 class TodoApp extends PolymerElement with ObservableMixin { 12 class TodoApp extends PolymerElement with ObservableMixin {
13 @observable AppModel app; 13 @observable AppModel app;
14 bool get applyAuthorStyles => true;
14 15
15 void created() { 16 void created() {
16 super.created(); 17 super.created();
17 app = appModel; 18 app = appModel;
18 } 19 }
19 20
20 void addTodo(Event e) { 21 void addTodo(Event e) {
21 e.preventDefault(); // don't submit the form 22 e.preventDefault(); // don't submit the form
22 var input = getShadowRoot('todo-app').query('#new-todo'); 23 var input = getShadowRoot('todo-app').query('#new-todo');
23 if (input.value == '') return; 24 if (input.value == '') return;
24 app.todos.add(new Todo(input.value)); 25 app.todos.add(new Todo(input.value));
25 input.value = ''; 26 input.value = '';
26 } 27 }
27 28
28 void clear() => app.clearDone(); 29 void clear() => app.clearDone();
29 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698