func Bind(v interface{}, parent func() js.Value) error {
	if err := checkType(v); err != nil {
		return err
	}
	rv := reflect.ValueOf(v).Elem()
	for i, f := range getFields(v) {
		tag := f.Tag.Get("js")
		if tag == "" {
			tag = f.Name
		}
		fv := rv.Field(i)
		ft := fv.Type()
		if k := ft.Kind(); k != reflect.Func {
			return fmt.Errorf("Field of type %s found, func expected", k)
		}
		var value reflect.Value
		switch {
		case isGetter(tag, ft):
			value = bindGetter(tag, ft.Out(0), parent)
		case isSetter(tag, ft):
			value = bindSetter(tag, ft.In(0), parent)
		case isFunction(tag):
			value = bindFunction(tag, ft, parent)
		}
		fv.Set(value)
	}
	return nil
}
Bind binds JS identifiers from the given JS parent reference
package bind
import (
	"fmt"
	"reflect"
	"syscall/js"
)
func BindGlobals(v interface{}) error {
	return Bind(v, js.Global)
}