Questions tagged [gopherjs]
A compiler from Go to JavaScript for running Go code in a browser.
20
questions
2
votes
1
answer
31
views
Query Models through Gorm
Here is my Lawyer Model
type Lawyer struct {
ID uint `gorm:"primaryKey" json:"id"`
FirstName string `gorm:"type:...
0
votes
0
answers
99
views
Golang x/sys "undeclared name: Timespec" error when using GopherJS
I just installed go with brew install go and installed gopherjs with go install github.com/gopherjs/gopherjs, and added this to my ~/.zshrc file:
export GOPATH="$HOME/go"
export PATH="$...
1
vote
0
answers
87
views
How to parse FormData into Map object
I'm trying to parse a form on submit in order to get its keys/values. I'am using FormData interface https://developer.mozilla.org/en-US/docs/Web/API/FormData to do it with the package HTML - from ...
1
vote
0
answers
205
views
Debugging Go wasm : It there a way to bridge an error message appearing in the browser tools to the source in Go?
Debugging Go wasm : It there a way to bridge an error message appearing in the browser tools to the source in Go?
For instance If one generates JavaScript code from TS code and runs it an a client-...
0
votes
0
answers
29
views
How to do a POST request with GopherJS and JSON
How do I modify the following example to exchange data (via a POST request), in JSON format, between a client app written with GopherJS and a server
func Post() {
var url = "http://localhost:...
-1
votes
1
answer
146
views
Problems with Go, GopherJS and vecty versions [closed]
There's three language (Go), compiler (GopherJS) and library (Vecty).
The problem is that GopherJS requires Go in version 12.x and Vecty requires Go in version 1.14+.
Somebody know how to set ...
0
votes
1
answer
766
views
Failed to convert Go file to JS
I am trying to run go files as modules using: https://github.com/sagiegurari/node-go-require and https://github.com/gopherjs
I dont have any errors in my go code but when using the below JS I run ...
0
votes
0
answers
330
views
chrome.runtime.sendMessage on console not working
I have a chrome extension and I am trying to send values from websites to the extension with chrome.runtime.sendMessage(). The thing is I have to do this from Go side using Gopher.js. I built a ...
0
votes
2
answers
85
views
Deadlock in goroutine with GopherJS
Why is there a deadlock in the following code? I am trying to return something from the goroutine to outside
package main
import (
"fmt"
"syscall/js"
"time"
)
func test(this js.Value, i ...
-1
votes
1
answer
118
views
Problems converting JavaScript to GopherJs
I am trying to convert this whole section of code from Javascript to GopherJs.
So far i have not been able to do event listeners as i am still a newbie to Javascript.
This is the JavaScript
window....
0
votes
1
answer
176
views
How to access a JavaScript object as an array
In GopherJS, members of an object are themselves objects (just as js handles things under the hood, ttbomk).
So when accessing a member, one gets back a *js.Object:
func makeRID(o *js.Object) string ...
0
votes
1
answer
254
views
Mysterious CSP violation
I am building a chrome extension. When I test it locally, I can take some actions that cause a CSP violation:
Refused to run the JavaScript URL because it violates the following Content Security ...
1
vote
0
answers
103
views
GopherJS and js/dom: all goroutines are asleep - deadlock
I'm not sure what's going on here, but I'm trying to load some GopherJS code using the js/dom library. Right now I call the routes and listen to the server and then load the scripts. Is this wrong?
...
0
votes
1
answer
76
views
Accessing $(this) in GopherJS
As an exercise, I'm converting a single page application from JavaScript to GopherJS.
In the JS code, the following appears:
var list = $('.all-products .products-list');
list.find('li').on('click', ...
0
votes
1
answer
37
views
Add JQuery to gopherjs test
When running gopherjs test, is there a simple way to include jquery.js for use in the test and code-under-test?
I am currently loading jquery from a CDN in my index.html, but can download it with npm ...
0
votes
1
answer
45
views
Get Cordova device in GopherJS
I'm going through a Cordova tutorial and trying to do the exercises in GopherJS. I installed the "device" plugin (cordova plugin add cordova-plugin-device) and am trying to get the fields of the ...
4
votes
1
answer
763
views
How to use a function from a JavaScript package produced by GopherJS?
I have written a simple package in Go and I have compiled with gopherJS .
I have then included it my HTML via
<script src="./testgopher.js">
It has been loaded and all is well. But I am not ...
2
votes
1
answer
359
views
Basic "Get Variable Value" Using GopherJS
I'm trying to use GopherJS, but I couldn't find documentation about how to use it.
Here's the Go code:
package main
import (
"github.com/gopherjs/gopherjs/js"
)
func main() {
t := js....
0
votes
1
answer
321
views
WebSocket compatibility with GopherJS [closed]
Looking for some general guidance on how to implement a WebSocket client in a way that works on both native Go execution platforms and through GopherJS.
It appears that GopherJS has two WebSocket ...
0
votes
1
answer
174
views
Go websockets data gopherjs
I'm currently trying to communicate using websockets and my code is the following (im using gorilla)
buff := bytes.NewBuffer([]byte{})
binary.Write(buff, binary.LittleEndian, uint64(1))
binary.Write(...