Skip to content

Commit a0ce966

Browse files
Add Get Going With WebAssembly
1 parent 60047cd commit a0ce966

40 files changed

+4617
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Running this presentation
2+
3+
## Requirements
4+
5+
Go present:
6+
7+
```bash
8+
$ go get golang.org/x/tools/present
9+
```
10+
11+
## Running
12+
13+
In order to fit in all the speakers notes for each slide I've made some small
14+
adjustments to the speaker notes CSS. To take advantage of this, make sure to
15+
run the presentation locally, specifying a custom base path.
16+
17+
```bash
18+
$ present -notes -base .
19+
Open your web browser and visit http://127.0.0.1:3999
20+
Notes are enabled, press 'N' from the browser to display them.
21+
```
22+
23+
Navigate to http://127.0.0.1:3999 to view the presentation.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
"strings"
6+
)
7+
8+
var contentTypeSetter = func(h http.Handler) http.Handler {
9+
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
10+
if strings.HasSuffix(req.URL.Path, ".wasm") {
11+
resp.Header().Set("content-type", "application/wasm")
12+
}
13+
h.ServeHTTP(resp, req)
14+
})
15+
}
16+
17+
func main() {
18+
fs := http.FileServer(http.Dir("./html"))
19+
http.ListenAndServe(":8080", contentTypeSetter(fs))
20+
}
Loading
Loading

JohanBrandhorst-GetGoingWithWebAssembly/gopherjs.svg

+1
Loading

JohanBrandhorst-GetGoingWithWebAssembly/gowasm.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
func main() {
4+
doc := webapiall.GetWindow().Document()
5+
d := doc.GetElementById("demo")
6+
d.SetInnerHTML("Hello <b>Go!</b>")
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import "syscall/js"
4+
5+
func setDemo() {
6+
doc := js.Global().Get("document")
7+
d := doc.Call("getElementById", "demo")
8+
d.Set("innerHTML", "Hello <b>Go!</b>")
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function setDemo() {
2+
let d = document.getElementById("demo")
3+
d.innerHTML = "Hello <b>Go!</b>"
4+
}
Loading

JohanBrandhorst-GetGoingWithWebAssembly/network.svg

+188
Loading
Loading

JohanBrandhorst-GetGoingWithWebAssembly/scientist.svg

+576
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
body {
2+
margin: 0;
3+
font-family: Helvetica, Arial, sans-serif;
4+
font-size: 16px;
5+
}
6+
pre,
7+
code {
8+
font-family: Menlo, monospace;
9+
font-size: 14px;
10+
}
11+
pre {
12+
line-height: 18px;
13+
margin: 0;
14+
padding: 0;
15+
}
16+
a {
17+
color: #375EAB;
18+
text-decoration: none;
19+
}
20+
a:hover {
21+
text-decoration: underline;
22+
}
23+
p, ul, ol {
24+
margin: 20px;
25+
}
26+
27+
h1, h2, h3, h4 {
28+
margin: 20px 0;
29+
padding: 0;
30+
color: #375EAB;
31+
font-weight: bold;
32+
}
33+
h1 {
34+
font-size: 18px;
35+
padding: 2px 5px;
36+
}
37+
h2 {
38+
font-size: 16px;
39+
}
40+
h3 {
41+
font-size: 16px;
42+
}
43+
h3, h4 {
44+
margin: 20px 5px;
45+
}
46+
h4 {
47+
font-size: 16px;
48+
}
49+
50+
div#heading {
51+
margin: 0 0 10px 0;
52+
padding: 21px 0;
53+
font-size: 20px;
54+
font-weight: bold;
55+
}
56+
57+
div#heading .author {
58+
padding-top: 10px;
59+
font-size: 14px;
60+
font-weight: normal;
61+
}
62+
63+
div#topbar {
64+
}
65+
66+
body {
67+
text-align: center;
68+
}
69+
div#page {
70+
width: 100%;
71+
}
72+
div#page > .container,
73+
div#topbar > .container {
74+
text-align: left;
75+
margin-left: auto;
76+
margin-right: auto;
77+
padding: 0 20px;
78+
width: 900px;
79+
}
80+
div#page.wide > .container,
81+
div#topbar.wide > .container {
82+
width: auto;
83+
}
84+
85+
div#footer {
86+
text-align: center;
87+
color: #666;
88+
font-size: 14px;
89+
margin: 40px 0;
90+
}
91+
92+
.author p {
93+
margin: 0;
94+
padding: 0 20px;
95+
}
96+
97+
div.code,
98+
div.output {
99+
margin: 20px 20px 20px 40px;
100+
-webkit-border-radius: 5px;
101+
-moz-border-radius: 5px;
102+
border-radius: 5px;
103+
}
104+
105+
div.output {
106+
padding: 10px;
107+
}
108+
109+
div.code { background: white; }
110+
div.output { background: black; }
111+
div.output .stdout { color: #e6e6e6; }
112+
div.output .stderr { color: rgb(244, 74, 63); }
113+
div.output .system { color: rgb(255, 209, 77) }
114+
115+
.buttons {
116+
margin-left: 20px;
117+
}
118+
div.output .buttons {
119+
margin-left: 0;
120+
margin-bottom: 10px;
121+
}
122+
123+
#toc {
124+
float: right;
125+
margin: 0px 10px;
126+
padding: 10px;
127+
border: 1px solid #e5ecf9;
128+
background-color: #eee;
129+
box-shadow: 3px 3px 2px #888888;
130+
131+
max-width: 33%;
132+
133+
-webkit-border-radius: 5px;
134+
-moz-border-radius: 5px;
135+
border-radius: 5px;
136+
}
137+
138+
#tochead {
139+
font-weight: bold;
140+
font-variant: small-caps;
141+
font-size: 100%;
142+
text-align: center;
143+
padding-bottom: 5px;
144+
}
145+
146+
#toc ul, #toc a {
147+
list-style-type: none;
148+
padding-left: 0px;
149+
color: black;
150+
margin: 0px;
151+
}
152+
153+
ul.toc-inner a {
154+
padding-left: 10px !important;
155+
}
156+
157+
@media print {
158+
.no-print, .no-print * {
159+
display: none !important;
160+
}
161+
}

0 commit comments

Comments
 (0)