func (o Object) Set(p string, x interface{}) {
	o.value.Set(p, ToJSValue(x))
}
Set sets the property p to the value of ToJSValue(x).
package wasm
import (
	"fmt"
	"syscall/js"
)
type TypeMismatchError struct {
	Expected js.Type
	Actual   js.Type
}
func (e TypeMismatchError) Error() string {
	return fmt.Sprintf("expected %v type, got %v type instead", e.Expected, e.Actual)
}
func Global() Object {
	global, err := NewObject(js.Global())
	if err != nil {
		panic(err)
	}
	return global
}
type Object struct {
	value js.Value
}
func NewObject(raw js.Value) (Object, error) {
	if raw.Type() != js.TypeObject {
		return Object{}, TypeMismatchError{
			Expected: js.TypeObject,
			Actual:   raw.Type(),
		}
	}
	return Object{raw}, nil
}
func (o Object) Get(path ...string) (js.Value, error) {
	current := o.value
	for _, v := range path {
		if current.Type() != js.TypeObject {
			return js.Value{}, TypeMismatchError{
				Expected: js.TypeObject,
				Actual:   current.Type(),
			}
		}
		current = current.Get(v)
	}
	return current, nil
}
func (o Object) Expect(expectedType js.Type, path ...string) (js.Value, error) {
	value, err := o.Get(path...)
	if err != nil {
		return js.Value{}, err
	}
	if value.Type() != expectedType {
		return js.Value{}, TypeMismatchError{
			Expected: expectedType,
			Actual:   value.Type(),
		}
	}
	return value, nil
}
func (o Object) Delete(p string) {
	o.value.Delete(p)
}
func (o Object) Equal(v js.Value) bool {
	return o.value.Equal(v)
}
func (o Object) Index(i int) js.Value {
	return o.value.Index(i)
}
func (o Object) InstanceOf(t js.Value) bool {
	if t.Type() != js.TypeFunction {
		return false
	}
	return o.value.InstanceOf(t)
}
func (o Object) JSValue() js.Value {
	return o.value
}
func (o Object) Length() int {
	return o.value.Length()
}