-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
35 lines (29 loc) · 698 Bytes
/
index.html
File metadata and controls
35 lines (29 loc) · 698 Bytes
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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Elm Timelines</title>
<style>
html {height: 100%;}
body {height: 100%; margin: 0;}
</style>
<script src="main.js">
</script>
</head>
<body>
<div id="app"></div>
</body>
<script>
const storedData = localStorage.getItem('elm-timelines')
const model = storedData ? JSON.parse(storedData) : null
const app = Elm.Main.init({
node: document.getElementById('app'),
flags: model
})
// Listen for commands from the `store` port.
// Turn the data to a string and put it in localStorage.
app.ports.store.subscribe(function (model) {
localStorage.setItem('elm-timelines', JSON.stringify(model))
})
</script>
</html>