-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.html
More file actions
37 lines (36 loc) · 1.06 KB
/
clock.html
File metadata and controls
37 lines (36 loc) · 1.06 KB
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 lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<title>Clock - Ring</title>
</head>
<body>
<main>
<h1><img src="../favicon.ico"> Clock</h1>
<h2></h2>
</main>
<script type="module">
import ring from "../index.js"
ring({
register: (update, dispatch) => ({
init: () => {
update(() => new Date())
setTimeout(() => {dispatch('init')}, 100)
}
}),
view: time => {
document.body.querySelector('h2').textContent =
!time ? '00:00:00' : [
time.getHours(),
time.getMinutes(),
time.getSeconds()
].map(n => (n < 10 ? '0' : '')+n).join(':')
}
})
</script>
</body>
</html>