A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rolaveric/gopherjs-demo below:

rolaveric/gopherjs-demo: A demo project showing how to use GopherJS to share Go code between Go and JS applications

A demo project showing how to use GopherJS to share Go code between Go and JS applications

Install gopherjs as a command line tool

go get -u github.com/gopherjs/gopherjs

A simple example of a Go struct being exported for use in JS code.

cd pet/js
gopherjs build main.go  
node index.js

A more complex example of a Go library that could be reused between Go and JS applications.

Note that, for brevity's sake, the user example does not include as much type checking as it should. For example, RegisterDBJS(jsdb) should check that jsdb really does include a Query() function.

To test in Go:

cd user/go
go run main.go

To test in NodeJS:

cd user/js
gopherjs build main.go
node index.js

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4