package main func defineClass(name string, constructor js.Value) func pointGetX(this js.Value, []inputs js.Value) interface{} { return this.Get("x") } func pointConstructor(this js.Value, []inputs js.Value) interface{} { this.Set("x", inputs[0]) this.Set("y", inputs[1]) return this; } func pointPrototype(this js.Value, []inputs js.Value) interface{} { this.Set("getX", js.FuncOf(pointGetX)) return nil } func main() { defineClass("Point", js.FuncOf(pointConstructor).Value) // Keep Golang running <-make(chan bool) }