-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
28 lines (24 loc) · 910 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTTP request for Starlight Enhanced for Starlark-go</title>
<script type="text/javascript" src="wasm_exec.js"></script>
</head>
<body>
<h2>HTTP Request from inside WASM using Starlark and Starlight Enhanced library</h2>
<p>This example uses <a href="https://github.com/1set/starlight">Starlight Enhanced</a> fork for Starlark in Go.</p>
<p>See the output in browser developer console.</p>
<p>Actual code:</p>
<pre>
print(httpget('https://httpbin.org/anything'))
</pre>
<script type="text/javascript">
const go = new Go();
WebAssembly.instantiateStreaming(fetch('main.wasm'), go.importObject).then((result) => {
go.run(result.instance);
});
</script>
<footer><small>Created for (wannabe-awesome) <a href="https://github.com/vasilev/HTTP-request-from-inside-WASM">list</a></small></footer>
</body>
</html>