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

Side by Side Diff: third_party/polymer/v0_8/components-chromium/more-routing/driver/hash-extracted.js

Issue 1155683008: Rename polymer and cr_elements v0_8 to v1_0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1
Patch Set: fix a merge mistake Created 5 years, 6 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
OLDNEW
(Empty)
1
2 (function(scope) {
3 var MoreRouting = scope.MoreRouting = scope.MoreRouting || {};
4 MoreRouting.HashDriver = HashDriver;
5
6 /**
7 * TODO(nevir): Docs.
8 */
9 function HashDriver() {
10 MoreRouting.Driver.apply(this, arguments);
11 this._bindEvents();
12 this._read();
13 }
14 HashDriver.prototype = Object.create(MoreRouting.Driver.prototype);
15
16 // By default, we prefer hashbang; but you can prefix with any string you wish.
17 HashDriver.prototype.prefix = '!/';
18
19 HashDriver.prototype.urlForParts = function urlForParts(parts) {
20 return '#' + MoreRouting.Driver.prototype.urlForParts.call(this, parts);
21 };
22
23 HashDriver.prototype.navigateToUrl = function navigateToUrl(url) {
24 window.location.hash = url;
25 };
26
27 HashDriver.prototype._bindEvents = function _bindEvents() {
28 window.addEventListener('hashchange', this._read.bind(this));
29 };
30
31 HashDriver.prototype._read = function _read() {
32 this.setCurrentPath(window.location.hash.substr(1) || this.prefix);
33 };
34
35 })(window);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698