-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
60 lines (56 loc) · 1.24 KB
/
test.js
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
import { Kefir } from "./kefir.js";
let button = localStorage.getItem("counter") || 0;
let clicked = false;
const ui = [
`css:
.clicked {
background-color: yellow;
transition: background-color 5s;
}
#click {
width: 100px;
height: 100px;
background-color: white;
border: 1px solid black;
}
`,
"Hello",
"br",
{
type: "button",
text: "Increment: " + button,
action: (e) => {
button++;
e.target.innerText = "Increment: " + button;
localStorage.setItem("counter", button);
},
id: "incr"
},
"br",
"br",
{
type: "button",
text: "Clear",
action: (e) => {
button = 0;
document.getElementById("incr").innerText = "Increment: " + button;
localStorage.setItem("counter", button);
}
},
"hr",
{
type: "input",
input_type: "checkbox",
action: () => {
document.getElementById("click").className = clicked ? "" : "clicked";
clicked = !clicked;
}
},
"Did you click it??",
{
type: "div",
id: "click"
}
]
const kefir = new Kefir(ui);
kefir.run();