blob: f0538cd896b6f7cd37b5cc4173b4bf81456ceef1 [file] [log] [blame]
<!--
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>