forked from gopherjs/gopherjs.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
43 lines (36 loc) · 882 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<title>Go Playground</title>
<script src="main.js" defer></script>
<style>
#code {
width: 100%;
height: 300px;
}
#output {
width: 100%;
height: 300px;
}
</style>
</head>
<body>
<h1>Go Playground</h1>
<p>__GOHPERJS__ should be exposed as a global, open the console and try running the following code</p>
<textarea id="code">
__GOPHERJS__.Compile(`
package main
import (
"fmt"
"syscall/js"
)
func main() {
// js.Global().Call("alert", "Hello, JavaScript")
js.Global().Get("console").Call("log", "Hello, JS console")
fmt.Println("test")
}
`, eval
)
</textarea>
</body>
</html>