ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components / more-routing / more-routing-config.html
blob3d9b70f935dcf11dd9145b209bbba9b211958742
1 <!--
2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
8 -->
9 <link rel="import" href="../polymer/polymer.html">
11 <link rel="import" href="routing.html">
12 <!-- TODO(nevir): import on demand? -->
13 <link rel="import" href="driver/hash.html">
14 <link rel="import" href="driver/mock.html">
15 <link rel="import" href="driver/path.html">
17 <script>
19 Polymer({
21 is: 'more-routing-config',
23 properties: {
25 /**
26 * The routing driver to use.
28 * * `hash`: `MoreRouting.HashDriver`
29 * * `path`: `MoreRouting.PathDriver`
30 * * `mock`: `MoreRouting.MockDriver`
33 driver: String,
35 /**
38 urlPrefix: String,
42 ready: function() {
43 var config = {};
44 if (this.urlPrefix) config.prefix = this.urlPrefix;
46 var driver;
47 // TODO(nevir): Support custom drivers, too.
48 if (this.driver === 'hash') {
49 driver = new MoreRouting.HashDriver(config);
50 } else if (this.driver === 'path') {
51 driver = new MoreRouting.PathDriver(config);
52 } else if (this.driver === 'mock') {
53 driver = new MoreRouting.MockDriver(config);
54 } else {
55 throw new Error('Unknown driver type "' + this.driver + '"');
58 MoreRouting.driver = driver;
61 });
63 </script>