| OLD | NEW |
| (Empty) |
| 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.g
ithub.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/CONTRI
BUTORS.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/PATEN
TS.txt | |
| 8 --> | |
| 9 <link rel="import" href="../polymer/polymer.html"> | |
| 10 | |
| 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"> | |
| 16 | |
| 17 <script> | |
| 18 | |
| 19 Polymer({ | |
| 20 | |
| 21 is: 'more-routing-config', | |
| 22 | |
| 23 properties: { | |
| 24 | |
| 25 /** | |
| 26 * The routing driver to use. | |
| 27 * | |
| 28 * * `hash`: `MoreRouting.HashDriver` | |
| 29 * * `path`: `MoreRouting.PathDriver` | |
| 30 * * `mock`: `MoreRouting.MockDriver` | |
| 31 * | |
| 32 */ | |
| 33 driver: String, | |
| 34 | |
| 35 /** | |
| 36 * | |
| 37 */ | |
| 38 urlPrefix: String, | |
| 39 | |
| 40 }, | |
| 41 | |
| 42 ready: function() { | |
| 43 var config = {}; | |
| 44 if (this.urlPrefix) config.prefix = this.urlPrefix; | |
| 45 | |
| 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 + '"'); | |
| 56 } | |
| 57 | |
| 58 MoreRouting.driver = driver; | |
| 59 }, | |
| 60 | |
| 61 }); | |
| 62 | |
| 63 </script> | |
| OLD | NEW |