{"action":"opened","issue":{"url":"https://api.github.com/repos/neelance/go/issues/9","repository_url":"https://api.github.com/repos/neelance/go","labels_url":"https://api.github.com/repos/neelance/go/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/neelance/go/issues/9/comments","events_url":"https://api.github.com/repos/neelance/go/issues/9/events","html_url":"https://github.com/neelance/go/issues/9","id":322514454,"number":9,"title":"Unexpected panic when using callback","user":{"login":"johanbrandhorst","id":6604151,"avatar_url":"https://avatars2.githubusercontent.com/u/6604151?v=4","gravatar_id":"","url":"https://api.github.com/users/johanbrandhorst","html_url":"https://github.com/johanbrandhorst","followers_url":"https://api.github.com/users/johanbrandhorst/followers","following_url":"https://api.github.com/users/johanbrandhorst/following{/other_user}","gists_url":"https://api.github.com/users/johanbrandhorst/gists{/gist_id}","starred_url":"https://api.github.com/users/johanbrandhorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanbrandhorst/subscriptions","organizations_url":"https://api.github.com/users/johanbrandhorst/orgs","repos_url":"https://api.github.com/users/johanbrandhorst/repos","events_url":"https://api.github.com/users/johanbrandhorst/events{/privacy}","received_events_url":"https://api.github.com/users/johanbrandhorst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-12T14:11:05Z","updated_at":"2018-05-12T14:11:05Z","closed_at":null,"author_association":"NONE","body":"Hi!\r\n\r\nI was trying out the new `syscall/js/callback` package, and I'm wondering if I'm using it correctly. The entire source for my test can be found on [my github](https://github.com/johanbrandhorst/wasm-experiments).\r\n\r\nI'm getting a panic when passing a `syscall/js/callback.Callback` to `syscall/js.Value.Call`. My example looks like this (abbreviated):\r\n\r\n```go\r\npromise := js.Global.Call(\"fetch\", \"http://google.com\")\r\npromise.Call(\"then\", callback.New(func(args []js.Value) {\r\n    fmt.Println(args)\r\n}))\r\n```\r\n\r\nThis results in the following panic:\r\n\r\n```bash\r\npanic: invalid value wasm_exec.js:59:6\r\nwasm_exec.js:59:6\r\ngoroutine 1 [running]: wasm_exec.js:59:6\r\nsyscall/js.ValueOf(0x3dc60, 0xc01e2d0, 0x1) wasm_exec.js:59:6\r\n    $GOPATH/src/github.com/neelance/go/src/syscall/js/js.go:95 +0x90 wasm_exec.js:59:6\r\nsyscall/js.makeArgs(0xc077d68, 0x1, 0x1, 0x691a0, 0xc01e2b8, 0x691a0) wasm_exec.js:59:6\r\n    $GOPATH/src/github.com/neelance/go/src/syscall/js/js.go:130 +0x7 wasm_exec.js:59:6\r\nsyscall/js.Value.Call(0x1a, 0x74e9f, 0x4, 0xc077d68, 0x1, 0x1, 0x1a) wasm_exec.js:59:6\r\n    $GOPATH/src/github.com/neelance/go/src/syscall/js/js.go:141 +0x2 wasm_exec.js:59:6\r\ngithub.com/johanbrandhorst/wasm-experiments/fetch/fetch.Fetch(0x1, 0xc0d2000, 0xc028b10, 0xc01e260, 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, ...) wasm_exec.js:59:6\r\n    $GOPATH/src/github.com/johanbrandhorst/wasm-experiments/fetch/fetch/fetch.go:73 +0x1f wasm_exec.js:59:6\r\nmain.main() wasm_exec.js:59:6\r\n    $GOPATH/src/github.com/johanbrandhorst/wasm-experiments/fetch/main.go:25 +0xc\r\n```"}}
{"actor":{"display_login":"johanbrandhorst"}}