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

Unified Diff: third_party/polymer/v0_8/components-chromium/more-routing/routing-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, 7 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: third_party/polymer/v0_8/components-chromium/more-routing/routing-extracted.js
diff --git a/third_party/polymer/v0_8/components-chromium/more-routing/routing-extracted.js b/third_party/polymer/v0_8/components-chromium/more-routing/routing-extracted.js
deleted file mode 100644
index 008b8fa0eb6db6db67a1035abb2f46d16220b92d..0000000000000000000000000000000000000000
--- a/third_party/polymer/v0_8/components-chromium/more-routing/routing-extracted.js
+++ /dev/null
@@ -1,126 +0,0 @@
-
-(function(scope) {
-var MoreRouting = scope.MoreRouting = scope.MoreRouting || {};
-
-// Route singletons.
-var routesByPath = {};
-var pathsByName = {};
-
-// Route Management
-
-/**
- * Retrieves (or builds) the singleton `Route` for the given path expression or
- * route name.
- *
- * Paths begin with `/`; anything else is considered a name.
- *
- * For convenience, `Route` objects can also be passed (and will be returned) -
- * this can be used as a route coercion function.
- *
- * @param {String|MoreRouting.Route} pathOrName
- * @param {MoreRouting.Route} parent
- * @return {MoreRouting.Route}
- */
-MoreRouting.getRoute = function getRoute(pathOrName, parent) {
- if (typeof pathOrName !== 'string') return pathOrName;
- if (this.isPath(pathOrName)) {
- return this.getRouteByPath(pathOrName, parent);
- } else {
- return this.getRouteByName(pathOrName);
- }
-}
-
-/**
- * Retrieves (or builds) the singleton `Route` for the given path expression.
- *
- * @param {String} path
- * @param {MoreRouting.Route} parent
- * @return {MoreRouting.Route}
- */
-MoreRouting.getRouteByPath = function getRouteByPath(path, parent) {
- var fullPath = (parent ? parent.fullPath : '') + path;
- if (!routesByPath[fullPath]) {
- routesByPath[fullPath] = new this.Route(path, parent);
- this.driver.manageRoute(routesByPath[fullPath]);
- }
- return routesByPath[fullPath];
-}
-
-/**
- * Retrieves the route registered via `name`.
- *
- * @param {String} name
- * @return {MoreRouting.Route}
- */
-MoreRouting.getRouteByName = function getRouteByName(name) {
- var path = pathsByName[name];
- if (!path) {
- throw new Error('No route named "' + name + '" has been registered');
- }
- return this.getRouteByPath(path);
-}
-
-/**
- * @param {String} path
- * @return {MoreRouting.Route} The newly registered route.
- */
-MoreRouting.registerNamedRoute = function registerNamedRoute(name, path, parent) {
- if (pathsByName[name]) {
- console.warn(
- 'Overwriting route named "' + name + '" with path:', path,
- 'previously:', pathsByName[name]);
- }
- var route = this.getRouteByPath(path, parent);
- pathsByName[name] = route.fullPath;
- return route;
-};
-
-// Route Shortcuts
-MoreRouting.urlFor = function urlFor(pathOrName, params) {
- return this.getRoute(pathOrName).urlFor(params);
-};
-
-MoreRouting.navigateTo = function navigateTo(pathOrName, params) {
- return this.getRoute(pathOrName).navigateTo(params);
-};
-
-MoreRouting.isCurrentUrl = function isCurrentUrl(pathOrName, params) {
- return this.getRoute(pathOrName).isCurrentUrl(params);
-};
-
-// Utility
-
-/**
- *
- */
-MoreRouting.isPath = function isPath(pathOrName) {
- return this.Route.isPath(pathOrName);
-}
-
-/**
- * @param {...String} paths
- */
-MoreRouting.joinPath = function joinPath(paths) {
- return this.Route.joinPath.apply(this.Route, arguments);
-}
-
-// Driver Management
-
-var driver;
-Object.defineProperty(MoreRouting, 'driver', {
- get: function getDriver() {
- if (!driver) {
- throw new Error('No routing driver configured. Did you forget <more-routing-config>?');
- }
- return driver;
- },
- set: function setDriver(newDriver) {
- if (driver) {
- console.warn('Changing routing drivers is not supported, ignoring. You should have only one <more-routing-config> on the page!');
- return;
- }
- driver = newDriver;
- }
-});
-
-})(window);

Powered by Google App Engine
This is Rietveld 408576698