-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
36 lines (29 loc) · 1.09 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script defer data-domain="stream-time.xyz" src="https://plausible.storetastic.cloud/js/script.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/javascript">
// Extract data from local storage.
const data = localStorage.getItem('data');
const flags = data ? JSON.parse(data) : null;
// Init Elm app, passing in the stored data as flags.
const app = Elm.Main.init({
node: document.getElementById('app'),
flags: flags
});
// Listen for commands from the `setStorage` port and persist data to local storage.
app.ports.setStorage.subscribe(function (state) {
localStorage.setItem('data', JSON.stringify(state));
});
// Listen for commands from the `removeStorage` port and remove local storage data.
app.ports.removeStorage.subscribe(function () {
localStorage.removeItem('data');
});
</script>
</body>
</html>