/
xhr.go
799 lines (710 loc) · 24.5 KB
/
xhr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
// Code generated by webidl-bind. DO NOT EDIT.
// +build !js
package xhr
import js "github.com/gowebapi/webapi/core/js"
import (
"github.com/gowebapi/webapi/core"
"github.com/gowebapi/webapi/dom/domcore"
"github.com/gowebapi/webapi/patch"
)
// using following types:
// domcore.Event
// domcore.EventHandler
// domcore.EventTarget
// patch.ByteString
// source idl files:
// xhr.idl
// transform files:
// xhr.go.md
// workaround for compiler error
func unused(value interface{}) {
// TODO remove this method
}
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}
}
// enum: XMLHttpRequestResponseType
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,
}
// JSValue is converting this enum into a javascript object
func (this *XMLHttpRequestResponseType) JSValue() js.Value {
return js.ValueOf(this.Value())
}
// Value is converting this into javascript defined
// string value
func (this XMLHttpRequestResponseType) Value() string {
idx := int(this)
if idx >= 0 && idx < len(xMLHttpRequestResponseTypeToWasmTable) {
return xMLHttpRequestResponseTypeToWasmTable[idx]
}
panic("unknown input value")
}
// XMLHttpRequestResponseTypeFromJS is converting a javascript value into
// a XMLHttpRequestResponseType enum value.
func XMLHttpRequestResponseTypeFromJS(value js.Value) XMLHttpRequestResponseType {
key := value.String()
conv, ok := xMLHttpRequestResponseTypeFromWasmTable[key]
if !ok {
panic("unable to convert '" + key + "'")
}
return conv
}
// dictionary: ProgressEventInit
type ProgressEventInit struct {
Bubbles bool
Cancelable bool
Composed bool
LengthComputable bool
Loaded int
Total int
}
// JSValue is allocating a new javascript object and copy
// all values
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
}
// ProgressEventInitFromJS is allocating a new
// ProgressEventInit object and copy all values in the value javascript object.
func ProgressEventInitFromJS(value js.Value) *ProgressEventInit {
var out ProgressEventInit
var (
value0 bool // javascript: boolean {bubbles Bubbles bubbles}
value1 bool // javascript: boolean {cancelable Cancelable cancelable}
value2 bool // javascript: boolean {composed Composed composed}
value3 bool // javascript: boolean {lengthComputable LengthComputable lengthComputable}
value4 int // javascript: unsigned long long {loaded Loaded loaded}
value5 int // javascript: unsigned long long {total Total total}
)
value0 = (value.Get("bubbles")).Bool()
out.Bubbles = value0
value1 = (value.Get("cancelable")).Bool()
out.Cancelable = value1
value2 = (value.Get("composed")).Bool()
out.Composed = value2
value3 = (value.Get("lengthComputable")).Bool()
out.LengthComputable = value3
value4 = (value.Get("loaded")).Int()
out.Loaded = value4
value5 = (value.Get("total")).Int()
out.Total = value5
return &out
}
// class: ProgressEvent
type ProgressEvent struct {
domcore.Event
}
// ProgressEventFromJS is casting a js.Value into ProgressEvent.
func ProgressEventFromJS(value js.Value) *ProgressEvent {
if typ := value.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
return nil
}
ret := &ProgressEvent{}
ret.Value_JS = value
return ret
}
// ProgressEventFromJS is casting from something that holds a js.Value into ProgressEvent.
func ProgressEventFromWrapper(input core.Wrapper) *ProgressEvent {
return ProgressEventFromJS(input.JSValue())
}
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 // javascript: ProgressEvent _what_return_name
)
_converted = ProgressEventFromJS(_returned)
_result = _converted
return
}
// LengthComputable returning attribute 'lengthComputable' with
// type bool (idl: boolean).
func (_this *ProgressEvent) LengthComputable() bool {
var ret bool
value := _this.Value_JS.Get("lengthComputable")
ret = (value).Bool()
return ret
}
// Loaded returning attribute 'loaded' with
// type int (idl: unsigned long long).
func (_this *ProgressEvent) Loaded() int {
var ret int
value := _this.Value_JS.Get("loaded")
ret = (value).Int()
return ret
}
// Total returning attribute 'total' with
// type int (idl: unsigned long long).
func (_this *ProgressEvent) Total() int {
var ret int
value := _this.Value_JS.Get("total")
ret = (value).Int()
return ret
}
// class: XMLHttpRequest
type XMLHttpRequest struct {
XMLHttpRequestEventTarget
}
// XMLHttpRequestFromJS is casting a js.Value into XMLHttpRequest.
func XMLHttpRequestFromJS(value js.Value) *XMLHttpRequest {
if typ := value.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
return nil
}
ret := &XMLHttpRequest{}
ret.Value_JS = value
return ret
}
// XMLHttpRequestFromJS is casting from something that holds a js.Value into XMLHttpRequest.
func XMLHttpRequestFromWrapper(input core.Wrapper) *XMLHttpRequest {
return XMLHttpRequestFromJS(input.JSValue())
}
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 // javascript: XMLHttpRequest _what_return_name
)
_converted = XMLHttpRequestFromJS(_returned)
_result = _converted
return
}
// OnReadyStateChange returning attribute 'onreadystatechange' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
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
}
// ReadyState returning attribute 'readyState' with
// type int (idl: unsigned short).
func (_this *XMLHttpRequest) ReadyState() int {
var ret int
value := _this.Value_JS.Get("readyState")
ret = (value).Int()
return ret
}
// Timeout returning attribute 'timeout' with
// type uint (idl: unsigned long).
func (_this *XMLHttpRequest) Timeout() uint {
var ret uint
value := _this.Value_JS.Get("timeout")
ret = (uint)((value).Int())
return ret
}
// SetTimeout setting attribute 'timeout' with
// type uint (idl: unsigned long).
func (_this *XMLHttpRequest) SetTimeout(value uint) {
input := value
_this.Value_JS.Set("timeout", input)
}
// WithCredentials returning attribute 'withCredentials' with
// type bool (idl: boolean).
func (_this *XMLHttpRequest) WithCredentials() bool {
var ret bool
value := _this.Value_JS.Get("withCredentials")
ret = (value).Bool()
return ret
}
// SetWithCredentials setting attribute 'withCredentials' with
// type bool (idl: boolean).
func (_this *XMLHttpRequest) SetWithCredentials(value bool) {
input := value
_this.Value_JS.Set("withCredentials", input)
}
// Upload returning attribute 'upload' with
// type XMLHttpRequestUpload (idl: XMLHttpRequestUpload).
func (_this *XMLHttpRequest) Upload() *XMLHttpRequestUpload {
var ret *XMLHttpRequestUpload
value := _this.Value_JS.Get("upload")
ret = XMLHttpRequestUploadFromJS(value)
return ret
}
// ResponseURL returning attribute 'responseURL' with
// type string (idl: USVString).
func (_this *XMLHttpRequest) ResponseURL() string {
var ret string
value := _this.Value_JS.Get("responseURL")
ret = (value).String()
return ret
}
// Status returning attribute 'status' with
// type int (idl: unsigned short).
func (_this *XMLHttpRequest) Status() int {
var ret int
value := _this.Value_JS.Get("status")
ret = (value).Int()
return ret
}
// StatusText returning attribute 'statusText' with
// type patch.ByteString (idl: ByteString).
func (_this *XMLHttpRequest) StatusText() *patch.ByteString {
var ret *patch.ByteString
value := _this.Value_JS.Get("statusText")
ret = patch.ByteStringFromJS(value)
return ret
}
// ResponseType returning attribute 'responseType' with
// type XMLHttpRequestResponseType (idl: XMLHttpRequestResponseType).
func (_this *XMLHttpRequest) ResponseType() XMLHttpRequestResponseType {
var ret XMLHttpRequestResponseType
value := _this.Value_JS.Get("responseType")
ret = XMLHttpRequestResponseTypeFromJS(value)
return ret
}
// SetResponseType setting attribute 'responseType' with
// type XMLHttpRequestResponseType (idl: XMLHttpRequestResponseType).
func (_this *XMLHttpRequest) SetResponseType(value XMLHttpRequestResponseType) {
input := value.JSValue()
_this.Value_JS.Set("responseType", input)
}
// Response returning attribute 'response' with
// type Any (idl: any).
func (_this *XMLHttpRequest) Response() js.Value {
var ret js.Value
value := _this.Value_JS.Get("response")
ret = value
return ret
}
// ResponseText returning attribute 'responseText' with
// type string (idl: USVString).
func (_this *XMLHttpRequest) ResponseText() string {
var ret string
value := _this.Value_JS.Get("responseText")
ret = (value).String()
return ret
}
// ResponseXML returning attribute 'responseXML' with
// type js.Value (idl: Document).
func (_this *XMLHttpRequest) ResponseXML() js.Value {
var ret js.Value
value := _this.Value_JS.Get("responseXML")
ret = value
return ret
}
// event attribute: domcore.Event
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)
}
// AddReadyStateChange is adding doing AddEventListener for 'ReadyStateChange' on target.
// This method is returning allocated javascript function that need to be released.
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
}
// SetOnReadyStateChange is assigning a function to 'onreadystatechange'. This
// This method is returning allocated javascript function that need to be released.
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 // javascript: ByteString _what_return_name
)
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 // javascript: ByteString _what_return_name
)
_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
}
// class: XMLHttpRequestEventTarget
type XMLHttpRequestEventTarget struct {
domcore.EventTarget
}
// XMLHttpRequestEventTargetFromJS is casting a js.Value into XMLHttpRequestEventTarget.
func XMLHttpRequestEventTargetFromJS(value js.Value) *XMLHttpRequestEventTarget {
if typ := value.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
return nil
}
ret := &XMLHttpRequestEventTarget{}
ret.Value_JS = value
return ret
}
// XMLHttpRequestEventTargetFromJS is casting from something that holds a js.Value into XMLHttpRequestEventTarget.
func XMLHttpRequestEventTargetFromWrapper(input core.Wrapper) *XMLHttpRequestEventTarget {
return XMLHttpRequestEventTargetFromJS(input.JSValue())
}
// OnLoadStart returning attribute 'onloadstart' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
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
}
// OnProgress returning attribute 'onprogress' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
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
}
// OnAbort returning attribute 'onabort' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
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
}
// OnError returning attribute 'onerror' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
func (_this *XMLHttpRequestEventTarget) OnError() domcore.EventHandlerFunc {
var ret domcore.EventHandlerFunc
value := _this.Value_JS.Get("onerror")
if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
ret = domcore.EventHandlerFromJS(value)
}
return ret
}
// OnLoad returning attribute 'onload' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
func (_this *XMLHttpRequestEventTarget) OnLoad() domcore.EventHandlerFunc {
var ret domcore.EventHandlerFunc
value := _this.Value_JS.Get("onload")
if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
ret = domcore.EventHandlerFromJS(value)
}
return ret
}
// OnTimeOut returning attribute 'ontimeout' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
func (_this *XMLHttpRequestEventTarget) OnTimeOut() domcore.EventHandlerFunc {
var ret domcore.EventHandlerFunc
value := _this.Value_JS.Get("ontimeout")
if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
ret = domcore.EventHandlerFromJS(value)
}
return ret
}
// OnLoadEnd returning attribute 'onloadend' with
// type domcore.EventHandler (idl: EventHandlerNonNull).
func (_this *XMLHttpRequestEventTarget) OnLoadEnd() domcore.EventHandlerFunc {
var ret domcore.EventHandlerFunc
value := _this.Value_JS.Get("onloadend")
if value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {
ret = domcore.EventHandlerFromJS(value)
}
return ret
}
// event attribute: ProgressEvent
func eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener func(event *ProgressEvent, target *XMLHttpRequestEventTarget)) js.Func {
fn := func(this js.Value, args []js.Value) interface{} {
var ret *ProgressEvent
value := args[0]
incoming := value.Get("target")
ret = ProgressEventFromJS(value)
src := XMLHttpRequestEventTargetFromJS(incoming)
listener(ret, src)
return js.Undefined()
}
return js.FuncOf(fn)
}
// AddAbort is adding doing AddEventListener for 'Abort' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventAbort(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "abort", cb)
return cb
}
// SetOnAbort is assigning a function to 'onabort'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnAbort(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onabort", cb)
return cb
}
// AddError is adding doing AddEventListener for 'Error' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventError(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "error", cb)
return cb
}
// SetOnError is assigning a function to 'onerror'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnError(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onerror", cb)
return cb
}
// AddLoad is adding doing AddEventListener for 'Load' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventLoad(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "load", cb)
return cb
}
// SetOnLoad is assigning a function to 'onload'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnLoad(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onload", cb)
return cb
}
// AddLoadEnd is adding doing AddEventListener for 'LoadEnd' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventLoadEnd(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "loadend", cb)
return cb
}
// SetOnLoadEnd is assigning a function to 'onloadend'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnLoadEnd(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onloadend", cb)
return cb
}
// AddLoadStart is adding doing AddEventListener for 'LoadStart' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventLoadStart(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "loadstart", cb)
return cb
}
// SetOnLoadStart is assigning a function to 'onloadstart'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnLoadStart(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onloadstart", cb)
return cb
}
// AddProgress is adding doing AddEventListener for 'Progress' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventProgress(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "progress", cb)
return cb
}
// SetOnProgress is assigning a function to 'onprogress'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnProgress(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("onprogress", cb)
return cb
}
// AddTimeOut is adding doing AddEventListener for 'TimeOut' on target.
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) AddEventTimeOut(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Call("addEventListener", "timeout", cb)
return cb
}
// SetOnTimeOut is assigning a function to 'ontimeout'. This
// This method is returning allocated javascript function that need to be released.
func (_this *XMLHttpRequestEventTarget) SetOnTimeOut(listener func(event *ProgressEvent, currentTarget *XMLHttpRequestEventTarget)) js.Func {
cb := eventFuncXMLHttpRequestEventTarget_ProgressEvent(listener)
_this.Value_JS.Set("ontimeout", cb)
return cb
}
// class: XMLHttpRequestUpload
type XMLHttpRequestUpload struct {
XMLHttpRequestEventTarget
}
// XMLHttpRequestUploadFromJS is casting a js.Value into XMLHttpRequestUpload.
func XMLHttpRequestUploadFromJS(value js.Value) *XMLHttpRequestUpload {
if typ := value.Type(); typ == js.TypeNull || typ == js.TypeUndefined {
return nil
}
ret := &XMLHttpRequestUpload{}
ret.Value_JS = value
return ret
}
// XMLHttpRequestUploadFromJS is casting from something that holds a js.Value into XMLHttpRequestUpload.
func XMLHttpRequestUploadFromWrapper(input core.Wrapper) *XMLHttpRequestUpload {
return XMLHttpRequestUploadFromJS(input.JSValue())
}