forked from rtfeldman/elm-spa-example
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
52 lines (49 loc) · 1.67 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
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Conduit</title>
<!-- Import Ionicon icons & Google Fonts our Bootstrap theme relies on -->
<link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Titillium+Web:700|Source+Serif+Pro:400,700|Merriweather+Sans:400,700|Source+Sans+Pro:400,300,600,700,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">
<!-- Import the custom Bootstrap 4 theme from our hosted CDN -->
<link rel="stylesheet" href="//demo.productionready.io/main.css">
<script src="elm.js"></script>
<style>
.loader {
opacity: 1;
animation-name: fadeIn;
animation-duration: 2s;
animation-timing-function: ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
</head>
<body>
<script>
var storageKey = "session";
var flags = localStorage.getItem(storageKey);
var app = Elm.Main.init({flags: flags});
app.ports.store.subscribe(function(value) {
if (value === null) {
localStorage.removeItem(storageKey);
} else {
localStorage.setItem(storageKey, JSON.stringify(value));
}
});
// Whenever localStorage changes in another tab, report it if necessary.
window.addEventListener("storage", function(event) {
if (event.storageArea === localStorage && event.key === storageKey) {
app.ports.onStoreChange.send(event.newValue);
}
}, false);
</script>
</body>
</html>