-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsketch.html
31 lines (31 loc) · 903 Bytes
/
sketch.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
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
align-items: center;
justify-content: center;
background: #FAFAFA;
}
canvas {
background: #FFFFFF;
}
</style>
<meta charset="utf-8">
</head>
<body>
<main></main>
<script src="https://unpkg.com/[email protected]/elm-canvas.js"></script>
<script src="sketch.js"></script>
<script>
// Usually you do `Elm.main.init({...})`, but every module has a different
// name, and we want to reuse this template with elm-live.
// Since everything is organised as <chapter>/<sketch>, we run init of
// the first nested object.
var firstProperty = (o) => o[Object.keys(o)[0]];
var module = firstProperty(firstProperty(Elm));
var app = module.init({ node: document.querySelector("main") });
</script>
</body>
</html>