Index: samples/third_party/todomvc_performance/js_todomvc/components/flatiron-director/flatiron-director.html |
diff --git a/samples/third_party/todomvc_performance/js_todomvc/components/flatiron-director/flatiron-director.html b/samples/third_party/todomvc_performance/js_todomvc/components/flatiron-director/flatiron-director.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0538cd896b6f7cd37b5cc4173b4bf81456ceef1 |
--- /dev/null |
+++ b/samples/third_party/todomvc_performance/js_todomvc/components/flatiron-director/flatiron-director.html |
@@ -0,0 +1,37 @@ |
+<!-- |
+Copyright 2013 The Polymer Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style |
+license that can be found in the LICENSE file. |
+--> |
+<link rel="import" href="../polymer/polymer.html"> |
+<script src="director/director.min.js"></script> |
+ |
+<polymer-element name="flatiron-director" attributes="route autoHash"> |
+ <script> |
+ (function() { |
+ var private_router; |
+ Polymer('flatiron-director', { |
+ autoHash: false, |
+ ready: function() { |
+ this.router.on(/(.*)/, function(route) { |
+ this.route = route; |
+ }.bind(this)); |
+ this.route = this.router.getRoute(0) || ''; |
+ }, |
+ routeChanged: function() { |
+ if (this.autoHash) { |
+ window.location.hash = this.route; |
+ } |
+ this.fire('director-route', this.route); |
+ }, |
+ get router() { |
+ if (!private_router) { |
+ private_router = new Router(); |
+ private_router.init(); |
+ } |
+ return private_router; |
+ } |
+ }); |
+ })(); |
+ </script> |
+</polymer-element> |