-
Notifications
You must be signed in to change notification settings - Fork 0
/
k-redirect.html
49 lines (42 loc) · 1.22 KB
/
k-redirect.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
<link rel="import" href="../polymer/polymer.html">
<!--
@demo demo/index.html basic demo
-->
<dom-module id="k-redirect">
<script>
Polymer({
is: 'k-redirect',
properties:
{
/* to set the destination URL */
to: {
type: String,
value: 'http://www.kang-cahya.com'
},
/* to set speed redirect. Unit within a millisecond. */
time: {
type: Number,
value: 10
},
/* to set redirect mode "ON" or "OFF" */
mode: {
type: String,
value: 'ON',
observer: '_run'
}
},
_run: function(mode)
{
var _self = this;
if(mode.length === 0)
{
_self.set('mode', 'ON');
}
if(mode.toUpperCase() === "ON")
{
setTimeout(function(){ window.location=_self.to; }, _self.time);
}
},
});
</script>
</dom-module>