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

Unified Diff: pkg/polymer_expression/example/streams/count_clicks.html

Issue 22950008: move fancy_syntax into Dart SVN (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more readme edits 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
Index: pkg/polymer_expression/example/streams/count_clicks.html
diff --git a/pkg/polymer_expression/example/streams/count_clicks.html b/pkg/polymer_expression/example/streams/count_clicks.html
new file mode 100644
index 0000000000000000000000000000000000000000..32aaa38cf0144cbc369d3e90beebb83a74f040bb
--- /dev/null
+++ b/pkg/polymer_expression/example/streams/count_clicks.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!--
+Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+for details. All rights reserved. Use of this source code is governed by a
+BSD-style license that can be found in the LICENSE file.
+-->
+
+<html>
+ <body>
+ <template id="test" bind="{{ mouseDown | count }}">
+ Clicks: {{ value }}
+ </template>
+ <script type="application/dart">
+ import 'dart:async';
+ import 'dart:html';
+ import 'package:polymer_expression/syntax.dart';
+ import 'package:polymer_expression/async.dart';
+ import 'package:mdv/mdv.dart' as mdv;
+ import 'package:observe/observe.dart';
+
+ count(StreamBinding s) {
+ var box = new ObservableBox();
+ box.value = 0;
+ s.stream.listen((e) { box.value++; });
+ return box;
+ }
+
+ main() {
+ mdv.initialize();
+
+ var globals = {
+ 'mouseDown': document.onMouseDown,
+ 'count': count,
+ };
+
+ query('#test')
+ ..bindingDelegate = new PolymerExpressions(globals: globals)
+ ..model = null;
+ }
+ </script>
+ <script src="packages/browser/dart.js"></script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698