OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('settings', function() { | 5 cr.define('settings', function() { |
6 /** | 6 /** |
7 * Class for navigable routes. May only be instantiated within this file. | 7 * Class for navigable routes. May only be instantiated within this file. |
8 * @constructor | 8 * @constructor |
9 * @param {string} path | 9 * @param {string} path |
10 * @private | 10 * @private |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 */ | 282 */ |
283 var getRouteForPath = function(path) { | 283 var getRouteForPath = function(path) { |
284 // Allow trailing slash in paths. | 284 // Allow trailing slash in paths. |
285 var canonicalPath = path.replace(CANONICAL_PATH_REGEX, '$1$2'); | 285 var canonicalPath = path.replace(CANONICAL_PATH_REGEX, '$1$2'); |
286 | 286 |
287 // TODO(tommycli): Use Object.values once Closure compilation supports it. | 287 // TODO(tommycli): Use Object.values once Closure compilation supports it. |
288 var matchingKey = Object.keys(Route).find(function(key) { | 288 var matchingKey = Object.keys(Route).find(function(key) { |
289 return Route[key].path == canonicalPath; | 289 return Route[key].path == canonicalPath; |
290 }); | 290 }); |
291 | 291 |
292 return !!matchingKey ? Route[matchingKey] : null; | 292 return matchingKey ? Route[matchingKey] : null; |
dpapad
2017/04/19 17:48:22
http://eslint.org/docs/rules/no-extra-boolean-cast
Dan Beam
2017/04/19 19:04:40
compiler will whine in some cases
dpapad
2017/05/05 18:20:46
Done, turned this off for now.
| |
293 }; | 293 }; |
294 | 294 |
295 /** | 295 /** |
296 * The current active route. This updated is only by settings.navigateTo or | 296 * The current active route. This updated is only by settings.navigateTo or |
297 * settings.initializeRouteFromUrl. | 297 * settings.initializeRouteFromUrl. |
298 * @private {!settings.Route} | 298 * @private {!settings.Route} |
299 */ | 299 */ |
300 var currentRoute_ = Route.BASIC; | 300 var currentRoute_ = Route.BASIC; |
301 | 301 |
302 /** | 302 /** |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 getRouteForPath: getRouteForPath, | 426 getRouteForPath: getRouteForPath, |
427 initializeRouteFromUrl: initializeRouteFromUrl, | 427 initializeRouteFromUrl: initializeRouteFromUrl, |
428 resetRouteForTesting: resetRouteForTesting, | 428 resetRouteForTesting: resetRouteForTesting, |
429 getCurrentRoute: getCurrentRoute, | 429 getCurrentRoute: getCurrentRoute, |
430 getQueryParameters: getQueryParameters, | 430 getQueryParameters: getQueryParameters, |
431 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate, | 431 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate, |
432 navigateTo: navigateTo, | 432 navigateTo: navigateTo, |
433 navigateToPreviousRoute: navigateToPreviousRoute, | 433 navigateToPreviousRoute: navigateToPreviousRoute, |
434 }; | 434 }; |
435 }); | 435 }); |
OLD | NEW |