forked from atotic/excess-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
excess-router-config.html
103 lines (87 loc) · 2.27 KB
/
excess-router-config.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="excess-route-manager.html">
<script>
/**
`excess-router-config` configures Polymer.RoutingManager routing library
Examples:
<excess-router-config
path-style="hash"
hash-prefix="#!"
></excess-router-config>
<excess-router-config
path-style="path"
base-prefix="/my"
></excess-router-config>
@demo
*/
Polymer({
is: 'excess-router-config',
properties: {
/**
* True if `<a href=` navigation should try router links first
*/
anchorRouting: {
type: Boolean,
value: true
},
/**
* True if RouteManager starts on WebComponentsReady.
* If false, you must call RouterManager.start manually
*/
manualStart: {
type: Boolean,
value: false
},
/**
* base path for path-based routing. Use it if your app is not mounted at the root.
* Example: app mounted on "http://example.com/polymerExamples/foo" should set the base path to `/polymerExamples/foo`
*/
basePath: {
type: String,
value: ''
},
/**
* prefix for hash paths, must start with '#'
*/
hashPrefix: {
type: String,
value: '#'
},
/**
* prefix for alias style paths
*/
aliasPathPrefix: {
type: String,
value: '@'
},
/**
* 'hash' for '#' routing, 'path' for paths
*/
pathStyle: {
type: String,
value: 'hash'
},
/**
* prefix for internally generated path tokens
*/
tokenPrefix: {
type: String,
value: 'toke-'
}
},
observers: [
'_configurationChanged(anchorRouting, manualStart, basePath, hashPrefix, aliasPathPrefix, pathStyle, tokenPrefix)'
],
_configurationChanged: function(anchorRouting, manualStart, basePath, hashPrefix, aliasPathPrefix, pathStyle, tokenPrefix) {
Excess.RouteManager.configure({
anchorRouting: anchorRouting,
autoStart: !manualStart,
basePath: basePath,
hashPrefix: hashPrefix,
aliasPathPrefix: aliasPathPrefix,
pathStyle: pathStyle,
tokenPrefix: tokenPrefix
});
}
});
</script>