func (b BaseObject) Empty() bool {
	return b.object == nil
}
Empty check if the struct is an empty Struct or have a JS Value attached
package baseobject
import (
	"errors"
	"syscall/js"
)
var setFunc js.Value
var getFunc js.Value
var callFunc js.Value
var invokeFunc js.Value
var errorInterface js.Value
func SetSyscall() {
	eval_(`hSet = (obj, set , value) => { try { Reflect.set(obj,set,value) ; return }catch(err){ return err } }`)
	eval_(`hGet = (obj, get ) => { try { return [true,Reflect.get(obj,get)] }catch(err){ return [false,err] } }`)
	eval_(`hCall = (obj,method,args) => { try { func=Reflect.get(obj,method); return [true,Reflect.apply(func,obj,args)] } catch (err) { return [false,err] } }`)
	eval_(`hInvoke = (func,args) => { try { return [true,Reflect.apply(func,undefined,args)] } catch (err) { return [false,err] } }`)
	setFunc = js.Global().Get("hSet")
	getFunc = js.Global().Get("hGet")
	callFunc = js.Global().Get("hCall")
	invokeFunc = js.Global().Get("hInvoke")
	errorInterface = js.Global().Get("Error")
}
func Set(obj js.Value, name string, val interface{}) error {
	var err error
	ret := setFunc.Invoke(obj, js.ValueOf(name), val)
	if !ret.IsUndefined() {
		err = errors.New(ret.Get("message").String())
	}
	return err
}
func Get(obj js.Value, name string) (js.Value, error) {
	ret := getFunc.Invoke(obj, js.ValueOf(name))
	if ret.Index(0).Bool() {
		return ret.Index(1), nil
	} else {
		return ret.Index(1), errors.New(ret.Index(1).Get("message").String())
	}
}
func Call(obj js.Value, name string, args ...interface{}) (js.Value, error) {
	var jsargs []interface{}
	for _, arg := range args {
		jsargs = append(jsargs, js.ValueOf(arg))
	}
	ret := callFunc.Invoke(obj, js.ValueOf(name), jsargs)
	if ret.Index(0).Bool() {
		return ret.Index(1), nil
	} else {
		return ret.Index(1), errors.New(ret.Index(1).Get("message").String())
	}
}
func Invoke(f js.Value, args ...interface{}) (js.Value, error) {
	var jsargs []interface{}
	for _, arg := range args {
		jsargs = append(jsargs, js.ValueOf(arg))
	}
	ret := invokeFunc.Invoke(f, jsargs)
	if ret.Index(0).Bool() {
		return ret.Index(1), nil
	} else {
		return ret.Index(1), errors.New(ret.Index(1).Get("message").String())
	}
}
func CopyBytesToGo(dst []byte, src js.Value) (int, error) {
	return js.CopyBytesToGo(dst, src), nil
}
func CopyBytesToJS(dst js.Value, src []byte) (int, error) {
	return js.CopyBytesToJS(dst, src), nil
}
var registry map[string]func(js.Value) (interface{}, error)
func Register(inter js.Value, contruct func(js.Value) (interface{}, error)) error {
	var obj js.Value
	var err error
	if registry == nil {
		registry = make(map[string]func(js.Value) (interface{}, error))
	}
	if obj, err = Get(inter, "name"); err == nil {
		if !obj.IsUndefined() {
			registry[obj.String()] = contruct
		}
	}
	return err
}
func Discover(obj js.Value) (interface{}, error) {
	var err error
	var bobj interface{}
	var objname js.Value
	var objconstructor js.Value
	if objconstructor, err = Get(obj, "constructor"); err == nil {
		if objname, err = Get(objconstructor, "name"); err == nil {
			if f, ok := registry[objname.String()]; ok {
				var obji interface{}
				var ok bool
				if obji, err = f(obj); err == nil {
					if bobj, ok = obji.(ObjectFrom); !ok {
						err = ErrNotABaseObject
					}
				}
			} else {
				bobj, err = NewFromJSObject(obj)
			}
		} else {
			bobj, err = NewFromJSObject(obj)
		}
	} else {
		bobj, err = NewFromJSObject(obj)
	}
	return bobj, err
}
type ObjectFrom interface {
	JSObject() js.Value
	BaseObject_() BaseObject
}
func (b BaseObject) BaseObject_() BaseObject {
	return b
}
func String(object js.Value) string {
	return object.String()
}
func ToStringWithErr(object js.Value) (string, error) {
	if object.Type() == js.TypeObject {
		if value, err := Call(object, "toString"); err == nil {
			return value.String(), nil
		} else {
			return "", err
		}
	}
	return "", ErrNotAnObject
}
type BaseObject struct {
	object *js.Value
}
func NewFromJSObject(obj js.Value) (BaseObject, error) {
	var o BaseObject
	if obj.IsUndefined() {
		return o, ErrNotAnObject
	}
	o.object = &obj
	return o, nil
}