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

Side by Side Diff: pkg/polymer_expressions/example/example.dart

Issue 370463005: update example in polymer_expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/polymer_expressions/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:html'; 5 import 'dart:html';
6 6
7 import 'package:polymer_expressions/polymer_expressions.dart'; 7 import 'package:polymer_expressions/polymer_expressions.dart';
8 import 'package:template_binding/template_binding.dart' show templateBind; 8 import 'package:template_binding/template_binding.dart' show templateBind;
9 9
10 // We use mirrors for illustration purposes, but ideally we would generate a
11 // static configuration with smoke/static.dart.
12 import 'package:smoke/mirrors.dart';
13
14 // Since we use smoke/mirrors, we need to preserve symbols used in the template.
15 // This includes String.startsWith, List.take, and Person.
16 @MirrorsUsed(targets: const [String, List, Person])
17 import 'dart:mirrors';
18
10 import 'person.dart'; 19 import 'person.dart';
11 20
12 main() { 21 main() {
22 useMirrors();
13 var john = new Person('John', 'Messerly', ['A', 'B', 'C']); 23 var john = new Person('John', 'Messerly', ['A', 'B', 'C']);
14 var justin = new Person('Justin', 'Fagnani', ['D', 'E', 'F']); 24 var justin = new Person('Justin', 'Fagnani', ['D', 'E', 'F']);
15 var globals = { 25 var globals = {
16 'uppercase': (String v) => v.toUpperCase(), 26 'uppercase': (String v) => v.toUpperCase(),
17 'people': [john, justin], 27 'people': [john, justin],
18 }; 28 };
19 29
20 templateBind(querySelector('#test')) 30 templateBind(querySelector('#test'))
21 ..bindingDelegate = new PolymerExpressions(globals: globals) 31 ..bindingDelegate = new PolymerExpressions(globals: globals)
22 ..model = john; 32 ..model = john;
23 33
24 templateBind(querySelector('#test2')).model = john; 34 templateBind(querySelector('#test2')).model = john;
25 } 35 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer_expressions/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698