mirror of
https://github.com/taigrr/wasm-experiments
synced 2025-01-18 04:03:21 -08:00
Remove bug folder
This commit is contained in:
parent
f6afc46304
commit
bf681695c7
@ -1,7 +0,0 @@
|
|||||||
build: clean compile
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f ../html/test.wasm
|
|
||||||
|
|
||||||
compile:
|
|
||||||
GOOS=js GOARCH=wasm GOROOT=$(GOPATH)/src/github.com/neelance/go/ $(GOPATH)/src/github.com/neelance/go/bin/go build -o ../html/test.wasm main.go
|
|
20
bug/main.go
20
bug/main.go
@ -1,20 +0,0 @@
|
|||||||
// +build js,wasm
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall/js"
|
|
||||||
"syscall/js/callback"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
wait := make(chan struct{})
|
|
||||||
promise := js.Global.Call("fetch", "https://api.github.com")
|
|
||||||
promise.Call("then", callback.New(func(args []js.Value) {
|
|
||||||
response := args[0]
|
|
||||||
r := response.Get("body").Call("getReader")
|
|
||||||
r.Call("read")
|
|
||||||
close(wait)
|
|
||||||
}).Value)
|
|
||||||
<-wait
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user