Description

Package js provides functions for interacting with native JavaScript APIs. Calls to these functions are treated specially by GopherJS and translated directly to their corresponding JavaScript syntax.

Use MakeWrapper to expose methods to JavaScript. When passing values directly, the following type conversions are performed:

| Go type               | JavaScript type       | Conversions back to interface{} |
| --------------------- | --------------------- | ------------------------------- |
| bool                  | Boolean               | bool                            |
| integers and floats   | Number                | float64                         |
| string                | String                | string                          |
| []int8                | Int8Array             | []int8                          |
| []int16               | Int16Array            | []int16                         |
| []int32, []int        | Int32Array            | []int                           |
| []uint8               | Uint8Array            | []uint8                         |
| []uint16              | Uint16Array           | []uint16                        |
| []uint32, []uint      | Uint32Array           | []uint                          |
| []float32             | Float32Array          | []float32                       |
| []float64             | Float64Array          | []float64                       |
| all other slices      | Array                 | []interface{}                   |
| arrays                | see slice type        | see slice type                  |
| functions             | Function              | func(...interface{}) *js.Object |
| time.Time             | Date                  | time.Time                       |
| -                     | instanceof Node       | *js.Object                      |
| maps, structs         | instanceof Object     | map[string]interface{}          |

Additionally, for a struct containing a *js.Object field, only the content of the field will be passed to JavaScript and vice versa.

js is referenced in 111 repositories

github.com/gopherjs/gopherjs github.com/Archs/js github.com/dominikh/go-js-dom

...