func (_this *XMLHttpRequestEventTarget) OnAbort() domcore.EventHandlerFunc {
	var ret domcore.EventHandlerFunc
	value := _this.Value_JS.Get("onabort")
	if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
		ret = domcore.EventHandlerFromJS(value)
	}
	return ret
}
OnAbort returning attribute 'onabort' with
type domcore.EventHandler (idl: EventHandlerNonNull).
package xhr
import "syscall/js"
import (
	"github.com/gowebapi/webapi/dom/domcore"
	"github.com/gowebapi/webapi/patch"
)
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 XMLHttpRequestResponseType int
const (
	EmptyString0XMLHttpRequestResponseType XMLHttpRequestResponseType = iota
	ArraybufferXMLHttpRequestResponseType
	BlobXMLHttpRequestResponseType
	DocumentXMLHttpRequestResponseType
	JsonXMLHttpRequestResponseType
	TextXMLHttpRequestResponseType
)
var xMLHttpRequestResponseTypeToWasmTable = []string{
	"", "arraybuffer", "blob", "document", "json", "text",
}
var xMLHttpRequestResponseTypeFromWasmTable = map[string]XMLHttpRequestResponseType{
	"": EmptyString0XMLHttpRequestResponseType, "arraybuffer": ArraybufferXMLHttpRequestResponseType, "blob": BlobXMLHttpRequestResponseType, "document": DocumentXMLHttpRequestResponseType, "json": JsonXMLHttpRequestResponseType, "text": TextXMLHttpRequestResponseType,
}
func (this *XMLHttpRequestResponseType) JSValue() js.Value {
	return js.ValueOf(this.Value())
}
func (this XMLHttpRequestResponseType) Value() string {
	idx := int(this)
	if idx >= 0 && idx < len(xMLHttpRequestResponseTypeToWasmTable) {
		return xMLHttpRequestResponseTypeToWasmTable[idx]
	}
	panic("unknown input value")
}
func XMLHttpRequestResponseTypeFromJS(value js.Value) XMLHttpRequestResponseType {
	key := value.String()
	conv, ok := xMLHttpRequestResponseTypeFromWasmTable[key]
	if !ok {
		panic("unable to convert '" + key + "'")
	}
	return conv
}
type ProgressEventInit struct {
	Bubbles          bool
	Cancelable       bool
	Composed         bool
	LengthComputable bool
	Loaded           int
	Total            int
}
func (_this *ProgressEventInit) JSValue() js.Value {
	out := js.Global().Get("Object").New()
	value0 := _this.Bubbles
	out.Set("bubbles", value0)
	value1 := _this.Cancelable
	out.Set("cancelable", value1)
	value2 := _this.Composed
	out.Set("composed", value2)
	value3 := _this.LengthComputable
	out.Set("lengthComputable", value3)
	value4 := _this.Loaded
	out.Set("loaded", value4)
	value5 := _this.Total
	out.Set("total", value5)
	return out
}
func ProgressEventInitFromJS(value js.Wrapper) *ProgressEventInit {
	input := value.JSValue()
	var out ProgressEventInit
	var (
		value0 bool  
		value1 bool  
		value2 bool  
		value3 bool  
		value4 int   
		value5 int   
	)
	value0 = (input.Get("bubbles")).Bool()
	out.Bubbles = value0
	value1 = (input.Get("cancelable")).Bool()
	out.Cancelable = value1
	value2 = (input.Get("composed")).Bool()
	out.Composed = value2
	value3 = (input.Get("lengthComputable")).Bool()
	out.LengthComputable = value3
	value4 = (input.Get("loaded")).Int()
	out.Loaded = value4
	value5 = (input.Get("total")).Int()
	out.Total = value5
	return &out
}
type ProgressEvent struct {
	domcore.Event
}
func ProgressEventFromJS(value js.Wrapper) *ProgressEvent {
	input := value.JSValue()
	if typ := input.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
		return nil
	}
	ret := &ProgressEvent{}
	ret.Value_JS = input
	return ret
}
func NewProgressEvent(_type string, eventInitDict *ProgressEventInit) (_result *ProgressEvent) {
	_klass := js.Global().Get("ProgressEvent")
	var (
		_args [2]interface{}
		_end  int
	)
	_p0 := _type
	_args[0] = _p0
	_end++
	if eventInitDict != nil {
		_p1 := eventInitDict.JSValue()
		_args[1] = _p1
		_end++
	}
	_returned := _klass.New(_args[0:_end]...)
	var (
		_converted *ProgressEvent  
	)
	_converted = ProgressEventFromJS(_returned)
	_result = _converted
	return
}
func (_this *ProgressEvent) LengthComputable() bool {
	var ret bool
	value := _this.Value_JS.Get("lengthComputable")
	ret = (value).Bool()
	return ret
}
func (_this *ProgressEvent) Loaded() int {
	var ret int
	value := _this.Value_JS.Get("loaded")
	ret = (value).Int()
	return ret
}
func (_this *ProgressEvent) Total() int {
	var ret int
	value := _this.Value_JS.Get("total")
	ret = (value).Int()
	return ret
}
type XMLHttpRequest struct {
	XMLHttpRequestEventTarget
}
func XMLHttpRequestFromJS(value js.Wrapper) *XMLHttpRequest {
	input := value.JSValue()
	if typ := input.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
		return nil
	}
	ret := &XMLHttpRequest{}
	ret.Value_JS = input
	return ret
}
const (
	UNSENT           int = 0
	OPENED           int = 1
	HEADERS_RECEIVED int = 2
	LOADING          int = 3
	DONE             int = 4
)
func NewXMLHttpRequest() (_result *XMLHttpRequest) {
	_klass := js.Global().Get("XMLHttpRequest")
	var (
		_args [0]interface{}
		_end  int
	)
	_returned := _klass.New(_args[0:_end]...)
	var (
		_converted *XMLHttpRequest  
	)
	_converted = XMLHttpRequestFromJS(_returned)
	_result = _converted
	return
}
func (_this *XMLHttpRequest) OnReadyStateChange() domcore.EventHandlerFunc {
	var ret domcore.EventHandlerFunc
	value := _this.Value_JS.Get("onreadystatechange")
	if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
		ret = domcore.EventHandlerFromJS(value)
	}
	return ret
}
func (_this *XMLHttpRequest) ReadyState() int {
	var ret int
	value := _this.Value_JS.Get("readyState")
	ret = (value).Int()
	return ret
}
func (_this *XMLHttpRequest) Timeout() uint {
	var ret uint
	value := _this.Value_JS.Get("timeout")
	ret = (uint)((value).Int())
	return ret
}
func (_this *XMLHttpRequest) SetTimeout(value uint) {
	input := value
	_this.Value_JS.Set("timeout", input)
}
func (_this *XMLHttpRequest) WithCredentials() bool {
	var ret bool
	value := _this.Value_JS.Get("withCredentials")
	ret = (value).Bool()
	return ret
}
func (_this *XMLHttpRequest) SetWithCredentials(value bool) {
	input := value
	_this.Value_JS.Set("withCredentials", input)
}
func (_this *XMLHttpRequest) Upload() *XMLHttpRequestUpload {
	var ret *XMLHttpRequestUpload
	value := _this.Value_JS.Get("upload")
	ret = XMLHttpRequestUploadFromJS(value)
	return ret
}
func (_this *XMLHttpRequest) ResponseURL() string {
	var ret string
	value := _this.Value_JS.Get("responseURL")
	ret = (value).String()
	return ret
}
func (_this *XMLHttpRequest) Status() int {
	var ret int
	value := _this.Value_JS.Get("status")
	ret = (value).Int()
	return ret
}
func (_this *XMLHttpRequest) StatusText() *patch.ByteString {
	var ret *patch.ByteString
	value := _this.Value_JS.Get("statusText")
	ret = patch.ByteStringFromJS(value)
	return ret
}
func (_this *XMLHttpRequest) ResponseType() XMLHttpRequestResponseType {
	var ret XMLHttpRequestResponseType
	value := _this.Value_JS.Get("responseType")
	ret = XMLHttpRequestResponseTypeFromJS(value)
	return ret
}
func (_this *XMLHttpRequest) SetResponseType(value XMLHttpRequestResponseType) {
	input := value.JSValue()
	_this.Value_JS.Set("responseType", input)
}
func (_this *XMLHttpRequest) Response() js.Value {
	var ret js.Value
	value := _this.Value_JS.Get("response")
	ret = value
	return ret
}
func (_this *XMLHttpRequest) ResponseText() string {
	var ret string
	value := _this.Value_JS.Get("responseText")
	ret = (value).String()
	return ret
}
func (_this *XMLHttpRequest) ResponseXML() js.Value {
	var ret js.Value
	value := _this.Value_JS.Get("responseXML")
	ret = value
	return ret
}
func eventFuncXMLHttpRequest_domcore_Event(listener func(event *domcore.Event, target *XMLHttpRequest)) js.Func {
	fn := func(this js.Value, args []js.Value) interface{} {
		var ret *domcore.Event
		value := args[0]
		incoming := value.Get("target")
		ret = domcore.EventFromJS(value)
		src := XMLHttpRequestFromJS(incoming)
		listener(ret, src)
		return js.Undefined()
	}
	return js.FuncOf(fn)
}
func (_this *XMLHttpRequest) AddEventReadyStateChange(listener func(event *domcore.Event, currentTarget *XMLHttpRequest)) js.Func {
	cb := eventFuncXMLHttpRequest_domcore_Event(listener)
	_this.Value_JS.Call("addEventListener", "readystatechange", cb)
	return cb
}
func (_this *XMLHttpRequest) SetOnReadyStateChange(listener func(event *domcore.Event, currentTarget *XMLHttpRequest)) js.Func {
	cb := eventFuncXMLHttpRequest_domcore_Event(listener)
	_this.Value_JS.Set("onreadystatechange", cb)
	return cb
}
func (_this *XMLHttpRequest) Open(method *patch.ByteString, url string) {
	var (
		_args [2]interface{}
		_end  int
	)
	_p0 := method.JSValue()
	_args[0] = _p0
	_end++
	_p1 := url
	_args[1] = _p1
	_end++
	_this.Value_JS.Call("open", _args[0:_end]...)
	return
}
func (_this *XMLHttpRequest) Open2(method *patch.ByteString, url string, async bool, username *string, password *string) {
	var (
		_args [5]interface{}
		_end  int
	)
	_p0 := method.JSValue()
	_args[0] = _p0
	_end++
	_p1 := url
	_args[1] = _p1
	_end++
	_p2 := async
	_args[2] = _p2
	_end++
	if username != nil {
		var _p3 interface{}
		if username != nil {
			_p3 = *(username)
		} else {
			_p3 = nil
		}
		_args[3] = _p3
		_end++
	}
	if password != nil {
		var _p4 interface{}
		if password != nil {
			_p4 = *(password)
		} else {
			_p4 = nil
		}
		_args[4] = _p4
		_end++
	}
	_this.Value_JS.Call("open", _args[0:_end]...)
	return
}
func (_this *XMLHttpRequest) SetRequestHeader(name *patch.ByteString, value *patch.ByteString) {
	var (
		_args [2]interface{}
		_end  int
	)
	_p0 := name.JSValue()
	_args[0] = _p0
	_end++
	_p1 := value.JSValue()
	_args[1] = _p1
	_end++
	_this.Value_JS.Call("setRequestHeader", _args[0:_end]...)
	return
}
func (_this *XMLHttpRequest) Send(body *Union) {
	var (
		_args [1]interface{}
		_end  int
	)
	if body != nil {
		_p0 := body.JSValue()
		_args[0] = _p0
		_end++
	}
	_this.Value_JS.Call("send", _args[0:_end]...)
	return
}
func (_this *XMLHttpRequest) Abort() {
	var (
		_args [0]interface{}
		_end  int
	)
	_this.Value_JS.Call("abort", _args[0:_end]...)
	return
}
func (_this *XMLHttpRequest) GetResponseHeader(name *patch.ByteString) (_result *patch.ByteString) {
	var (
		_args [1]interface{}
		_end  int
	)
	_p0 := name.JSValue()
	_args[0] = _p0
	_end++
	_returned := _this.Value_JS.Call("getResponseHeader", _args[0:_end]...)
	var (
		_converted *patch.ByteString  
	)
	if _returned.Type() != js.TypeNull && _returned.Type() != js.TypeUndefined {
		_converted = patch.ByteStringFromJS(_returned)
	}
	_result = _converted
	return
}
func (_this *XMLHttpRequest) GetAllResponseHeaders() (_result *patch.ByteString) {
	var (
		_args [0]interface{}
		_end  int
	)
	_returned := _this.Value_JS.Call("getAllResponseHeaders", _args[0:_end]...)
	var (
		_converted *patch.ByteString  
	)
	_converted = patch.ByteStringFromJS(_returned)
	_result = _converted
	return
}
func (_this *XMLHttpRequest) OverrideMimeType(mime string) {
	var (
		_args [1]interface{}
		_end  int
	)
	_p0 := mime
	_args[0] = _p0
	_end++
	_this.Value_JS.Call("overrideMimeType", _args[0:_end]...)
	return
}
type XMLHttpRequestEventTarget struct {
	domcore.EventTarget
}
func XMLHttpRequestEventTargetFromJS(value js.Wrapper) *XMLHttpRequestEventTarget {
	input := value.JSValue()
	if typ := input.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
		return nil
	}
	ret := &XMLHttpRequestEventTarget{}
	ret.Value_JS = input
	return ret
}
func (_this *XMLHttpRequestEventTarget) OnLoadStart() domcore.EventHandlerFunc {
	var ret domcore.EventHandlerFunc
	value := _this.Value_JS.Get("onloadstart")
	if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
		ret = domcore.EventHandlerFromJS(value)
	}
	return ret
}
func (_this *XMLHttpRequestEventTarget) OnProgress() domcore.EventHandlerFunc {
	var ret domcore.EventHandlerFunc
	value := _this.Value_JS.Get("onprogress")
	if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
		ret = domcore.EventHandlerFromJS(value)
	}
	return ret
}