-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
37 lines (31 loc) · 1.01 KB
/
index.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 lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TinHat Demo</title>
</head>
<body>
<div id="counter">0</div>
<div id="username">(not set)</div>
<input type="text" value="" oninput='settings.update({...settings, "username": this.value})' />
<script src="tinhat.js"></script>
<script>
// Have to do this because we're referring to a module inside vanilla html
count = thReactive(0);
settings = thReactive({
"username": ""
});
thWatch(count, (_, newValue) => {
thSetInner("#counter", newValue)
});
thWatch(settings, (_, newValue) => {
thSetInner("#username", newValue.username)
thAttributeSet("#username", "valid", true);
});
setInterval(() => {
count.update(count.value + 1);
},1000)
</script>
</body>
</html>