March 2019
Beginner to intermediate
324 pages
7h 17m
English
Typically, JavaScript code runs either on Node.js or in the browser. Any code that runs on Node.js should have access to what is known as Node.js global objects (https://nodejs.org/api/globals.html). If your code ends up running on a Node.js environment, GopherJS gives you access to the global objects using the js.Global variable, which returns a *js.Object that hosts your global variables. You can then access a specific object using a method called Get, then call the object methods using a method called Call. Let's see an example to better explain this paragraph.
Run the following code:
package mainimport ( "github.com/gopherjs/gopherjs/js")func main() { //the console variable is of type *js.Object ...Read now
Unlock full access