| Index: example/streams/count_clicks.html
|
| diff --git a/example/streams/count_clicks.html b/example/streams/count_clicks.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d0b73ddb14b974532438d06a2bb99d0ac48a078
|
| --- /dev/null
|
| +++ b/example/streams/count_clicks.html
|
| @@ -0,0 +1,40 @@
|
| +<!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 }}" syntax="fancy">
|
| + Clicks: {{ value }}
|
| + </template>
|
| + <script type="application/dart">
|
| + import 'dart:async';
|
| + import 'dart:html';
|
| + import 'package:fancy_syntax/syntax.dart';
|
| + import 'package:fancy_syntax/async.dart';
|
| + import 'package:mdv_observe/mdv_observe.dart';
|
| +
|
| + count(StreamBinding s) {
|
| + var box = new ObservableBox();
|
| + box.value = 0;
|
| + s.stream.listen((e) { box.value++; });
|
| + return box;
|
| + }
|
| +
|
| + main() {
|
| + var globals = {
|
| + 'mouseDown': document.onMouseDown,
|
| + 'count': count,
|
| + };
|
| +
|
| + TemplateElement.syntax['fancy'] = new FancySyntax(globals: globals);
|
| +
|
| + query('#test').model = null;
|
| + }
|
| + </script>
|
| + <script src="packages/browser/dart.js"></script>
|
| + </body>
|
| +</html>
|
|
|