func IntersectionObserverEntryFromJS(value js.Wrapper) *IntersectionObserverEntry {
	input := value.JSValue()
	if typ := input.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
		return nil
	}
	ret := &IntersectionObserverEntry{}
	ret.Value_JS = input
	return ret
}
IntersectionObserverEntryFromJS is casting a js.Wrapper into IntersectionObserverEntry.
package intersection
import "syscall/js"
import (
	"github.com/gowebapi/webapi/dom"
	"github.com/gowebapi/webapi/dom/geometry"
	"github.com/gowebapi/webapi/javascript"
)
func unused(value interface{}) {
}
type Union struct {
	Value js.Value
}
func (u *Union) JSValue() js.Value {
	return u.Value
}
func UnionFromJS(value js.Value) *Union {
	return &Union{Value: value}
}
type IntersectionObserverCallbackFunc func(entries []*IntersectionObserverEntry, observer *IntersectionObserver)
type IntersectionObserverCallback js.Func
func IntersectionObserverCallbackToJS(callback IntersectionObserverCallbackFunc) *IntersectionObserverCallback {
	if callback == nil {
		return nil
	}
	ret := IntersectionObserverCallback(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		var (
			_p0 []*IntersectionObserverEntry  
			_p1 *IntersectionObserver         
		)
		__length0 := args[0].Length()
		__array0 := make([]*IntersectionObserverEntry, __length0, __length0)
		for __idx0 := 0; __idx0 < __length0; __idx0++ {
			var __seq_out0 *IntersectionObserverEntry
			__seq_in0 := args[0].Index(__idx0)
			__seq_out0 = IntersectionObserverEntryFromJS(__seq_in0)
			__array0[__idx0] = __seq_out0
		}
		_p0 = __array0
		_p1 = IntersectionObserverFromJS(args[1])
		callback(_p0, _p1)
		return nil
	}))
	return &ret
}
func IntersectionObserverCallbackFromJS(_value js.Value) IntersectionObserverCallbackFunc {
	return func(entries []*IntersectionObserverEntry, observer *IntersectionObserver) {
		var (
			_args [2]interface{}
			_end  int
		)
		_p0 := js.Global().Get("Array").New(len(entries))
		for __idx0, __seq_in0 := range entries {
			__seq_out0 := __seq_in0.JSValue()
			_p0.SetIndex(__idx0, __seq_out0)
		}
		_args[0] = _p0
		_end++
		_p1 := observer.JSValue()
		_args[1] = _p1
		_end++
		_value.Invoke(_args[0:_end]...)
		return
	}
}
type IntersectionObserverEntryInit struct {
	Time               float64
	RootBounds         *geometry.DOMRectInit
	BoundingClientRect *geometry.DOMRectInit
	IntersectionRect   *geometry.DOMRectInit
	IsIntersecting     bool
	IntersectionRatio  float64
	Target             *dom.Element
}
func (_this *IntersectionObserverEntryInit) JSValue() js.Value {
	out := js.Global().Get("Object").New()
	value0 := _this.Time
	out.Set("time", value0)
	value1 := _this.RootBounds.JSValue()
	out.Set("rootBounds", value1)
	value2 := _this.BoundingClientRect.JSValue()
	out.Set("boundingClientRect", value2)
	value3 := _this.IntersectionRect.JSValue()
	out.Set("intersectionRect", value3)
	value4 := _this.IsIntersecting
	out.Set("isIntersecting", value4)
	value5 := _this.IntersectionRatio
	out.Set("intersectionRatio", value5)
	value6 := _this.Target.JSValue()
	out.Set("target", value6)
	return out
}
func IntersectionObserverEntryInitFromJS(value js.Wrapper) *IntersectionObserverEntryInit {
	input := value.JSValue()
	var out IntersectionObserverEntryInit
	var (
		value0 float64                
		value1 *geometry.DOMRectInit  
		value2 *geometry.DOMRectInit  
		value3 *geometry.DOMRectInit  
		value4 bool                   
		value5 float64                
		value6 *dom.Element           
	)
	value0 = (input.Get("time")).Float()
	out.Time = value0
	if input.Get("rootBounds").Type() != js.TypeNull && input.Get("rootBounds").Type() != js.TypeUndefined {
		value1 = geometry.DOMRectInitFromJS(input.Get("rootBounds"))
	}
	out.RootBounds = value1
	value2 = geometry.DOMRectInitFromJS(input.Get("boundingClientRect"))
	out.BoundingClientRect = value2
	value3 = geometry.DOMRectInitFromJS(input.Get("intersectionRect"))
	out.IntersectionRect = value3
	value4 = (input.Get("isIntersecting")).Bool()
	out.IsIntersecting = value4
	value5 = (input.Get("intersectionRatio")).Float()
	out.IntersectionRatio = value5
	value6 = dom.ElementFromJS(input.Get("target"))
	out.Target = value6
	return &out
}
type IntersectionObserverInit struct {
	Root       *dom.Element
	RootMargin string
	Threshold  *Union
}
func (_this *IntersectionObserverInit) JSValue() js.Value {
	out := js.Global().Get("Object").New()
	value0 := _this.Root.JSValue()
	out.Set("root", value0)
	value1 := _this.RootMargin
	out.Set("rootMargin", value1)
	value2 := _this.Threshold.JSValue()
	out.Set("threshold", value2)
	return out
}
func IntersectionObserverInitFromJS(value js.Wrapper) *IntersectionObserverInit {
	input := value.JSValue()
	var out IntersectionObserverInit
	var (
		value0 *dom.Element  
		value1 string        
		value2 *Union        
	)
	if input.Get("root").Type() != js.TypeNull && input.Get("root").Type() != js.TypeUndefined {
		value0 = dom.ElementFromJS(input.Get("root"))
	}
	out.Root = value0
	value1 = (input.Get("rootMargin")).String()
	out.RootMargin = value1
	value2 = UnionFromJS(input.Get("threshold"))
	out.Threshold = value2
	return &out
}
type IntersectionObserver struct {
	Value_JS js.Value
}
func (_this *IntersectionObserver) JSValue() js.Value {
	return _this.Value_JS
}
func IntersectionObserverFromJS(value js.Wrapper) *IntersectionObserver {
	input := value.JSValue()
	if typ := input.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
		return nil
	}
	ret := &IntersectionObserver{}
	ret.Value_JS = input
	return ret
}
func NewIntersectionObserver(callback *IntersectionObserverCallback, options *IntersectionObserverInit) (_result *IntersectionObserver) {
	_klass := js.Global().Get("IntersectionObserver")
	var (
		_args [2]interface{}
		_end  int
	)
	var __callback0 js.Value
	if callback != nil {
		__callback0 = (*callback).Value
	} else {
		__callback0 = js.Null()
	}
	_p0 := __callback0
	_args[0] = _p0
	_end++
	if options != nil {
		_p1 := options.JSValue()
		_args[1] = _p1
		_end++
	}
	_returned := _klass.New(_args[0:_end]...)
	var (
		_converted *IntersectionObserver  
	)
	_converted = IntersectionObserverFromJS(_returned)
	_result = _converted
	return
}
func (_this *IntersectionObserver) Root() *dom.Element {
	var ret *dom.Element
	value := _this.Value_JS.Get("root")
	if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
		ret = dom.ElementFromJS(value)
	}
	return ret
}
func (_this *IntersectionObserver) RootMargin() string {
	var ret string
	value := _this.Value_JS.Get("rootMargin")
	ret = (value).String()
	return ret
}
func (_this *IntersectionObserver) Thresholds() *javascript.FrozenArray {
	var ret *javascript.FrozenArray
	value := _this.Value_JS.Get("thresholds")
	ret = javascript.FrozenArrayFromJS(value)
	return ret
}
func (_this *IntersectionObserver) Observe(target *dom.Element) {
	var (
		_args [1]interface{}
		_end  int
	)
	_p0 := target.JSValue()
	_args[0] = _p0
	_end++
	_this.Value_JS.Call("observe", _args[0:_end]...)
	return
}
func (_this *IntersectionObserver) Unobserve(target *dom.Element) {
	var (
		_args [1]interface{}
		_end  int
	)
	_p0 := target.JSValue()
	_args[0] = _p0
	_end++
	_this.Value_JS.Call("unobserve", _args[0:_end]...)
	return
}
func (_this *IntersectionObserver) Disconnect() {
	var (
		_args [0]interface{}
		_end  int
	)
	_this.Value_JS.Call("disconnect", _args[0:_end]...)
	return
}
func (_this *IntersectionObserver) TakeRecords() (_result []*IntersectionObserverEntry) {
	var (
		_args [0]interface{}
		_end  int
	)
	_returned := _this.Value_JS.Call("takeRecords", _args[0:_end]...)
	var (
		_converted []*IntersectionObserverEntry  
	)
	__length0 := _returned.Length()
	__array0 := make([]*IntersectionObserverEntry, __length0, __length0)
	for __idx0 := 0; __idx0 < __length0; __idx0++ {
		var __seq_out0 *IntersectionObserverEntry
		__seq_in0 := _returned.Index(__idx0)
		__seq_out0 = IntersectionObserverEntryFromJS(__seq_in0)
		__array0[__idx0] = __seq_out0
	}
	_converted = __array0
	_result = _converted
	return
}
type IntersectionObserverEntry struct {
	Value_JS js.Value
}
func (_this *IntersectionObserverEntry) JSValue() js.Value {
	return _this.Value_JS
}