-
Notifications
You must be signed in to change notification settings - Fork 2
/
xtag.html
37 lines (37 loc) · 1.05 KB
/
xtag.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
<!doctype html>
<html>
<head>
<title>beadga.me</title>
<script src="node_modules/x-tag/dist/x-tag-core.min.js"></script>
<script>
xtag.register('x-clock', {
lifecycle: {
created: function(){
this.start();
}
},
methods: {
start: function(){
this.update();
this.xtag.interval = setInterval(this.update.bind(this), 1000);
},
stop: function(){
this.xtag.interval = clearInterval(this.xtag.interval);
},
update: function(){
this.textContent = new Date().toLocaleTimeString();
}
},
events: {
tap: function(){
if (this.xtag.interval) this.stop();
else this.start();
}
}
});
</script>
</head>
<body>
<x-clock></x-clock>
</body>
</html>