-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
42 lines (33 loc) · 1.02 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
38
39
40
41
42
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>♦♣ Blackjack ♥♠</title>
<meta name="description" content="Blackjack made in Elm">
<link rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🃏</text></svg>">
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" src="elm.js"></script>
</head>
<body>
<pre id="elm"></pre>
<script>
const statisticsKey = "statistics-v1"
const statistics = (() => {
const statistics = window.localStorage?.getItem(statisticsKey)
if (!statistics)
return null
return JSON.parse(statistics)
})()
const elm = Elm.Main.init({
node: document.getElementById("elm"), flags: {
statistics: statistics
}
})
elm.ports.updateStatistics.subscribe(statistics => {
window.localStorage?.setItem(statisticsKey, JSON.stringify(statistics))
})
</script>
</body>
</html>