github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/sockets/udp/apis_js_wasm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package udp
     5  
     6  import (
     7  	"github.com/primecitizens/pcz/std/core/abi"
     8  	"github.com/primecitizens/pcz/std/core/mark"
     9  	"github.com/primecitizens/pcz/std/ffi/js"
    10  	"github.com/primecitizens/pcz/std/plat/js/webext/sockets/udp/bindings"
    11  )
    12  
    13  type BindCallbackFunc func(this js.Ref, result int32) js.Ref
    14  
    15  func (fn BindCallbackFunc) Register() js.Func[func(result int32)] {
    16  	return js.RegisterCallback[func(result int32)](
    17  		fn, abi.FuncPCABIInternal(fn),
    18  	)
    19  }
    20  
    21  func (fn BindCallbackFunc) DispatchCallback(
    22  	targetPC uintptr, ctx *js.CallbackContext,
    23  ) {
    24  	args := ctx.Args()
    25  	if len(args) != 1+1 /* js this */ ||
    26  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    27  		js.ThrowInvalidCallbackInvocation()
    28  	}
    29  
    30  	if ctx.Return(fn(
    31  		args[0],
    32  
    33  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
    34  	)) {
    35  		return
    36  	}
    37  
    38  	js.ThrowCallbackValueNotReturned()
    39  }
    40  
    41  type BindCallback[T any] struct {
    42  	Fn  func(arg T, this js.Ref, result int32) js.Ref
    43  	Arg T
    44  }
    45  
    46  func (cb *BindCallback[T]) Register() js.Func[func(result int32)] {
    47  	return js.RegisterCallback[func(result int32)](
    48  		cb, abi.FuncPCABIInternal(cb.Fn),
    49  	)
    50  }
    51  
    52  func (cb *BindCallback[T]) DispatchCallback(
    53  	targetPC uintptr, ctx *js.CallbackContext,
    54  ) {
    55  	args := ctx.Args()
    56  	if len(args) != 1+1 /* js this */ ||
    57  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
    58  		js.ThrowInvalidCallbackInvocation()
    59  	}
    60  
    61  	if ctx.Return(cb.Fn(
    62  		cb.Arg,
    63  		args[0],
    64  
    65  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
    66  	)) {
    67  		return
    68  	}
    69  
    70  	js.ThrowCallbackValueNotReturned()
    71  }
    72  
    73  type CloseCallbackFunc func(this js.Ref) js.Ref
    74  
    75  func (fn CloseCallbackFunc) Register() js.Func[func()] {
    76  	return js.RegisterCallback[func()](
    77  		fn, abi.FuncPCABIInternal(fn),
    78  	)
    79  }
    80  
    81  func (fn CloseCallbackFunc) DispatchCallback(
    82  	targetPC uintptr, ctx *js.CallbackContext,
    83  ) {
    84  	args := ctx.Args()
    85  	if len(args) != 0+1 /* js this */ ||
    86  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    87  		js.ThrowInvalidCallbackInvocation()
    88  	}
    89  
    90  	if ctx.Return(fn(
    91  		args[0],
    92  	)) {
    93  		return
    94  	}
    95  
    96  	js.ThrowCallbackValueNotReturned()
    97  }
    98  
    99  type CloseCallback[T any] struct {
   100  	Fn  func(arg T, this js.Ref) js.Ref
   101  	Arg T
   102  }
   103  
   104  func (cb *CloseCallback[T]) Register() js.Func[func()] {
   105  	return js.RegisterCallback[func()](
   106  		cb, abi.FuncPCABIInternal(cb.Fn),
   107  	)
   108  }
   109  
   110  func (cb *CloseCallback[T]) DispatchCallback(
   111  	targetPC uintptr, ctx *js.CallbackContext,
   112  ) {
   113  	args := ctx.Args()
   114  	if len(args) != 0+1 /* js this */ ||
   115  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   116  		js.ThrowInvalidCallbackInvocation()
   117  	}
   118  
   119  	if ctx.Return(cb.Fn(
   120  		cb.Arg,
   121  		args[0],
   122  	)) {
   123  		return
   124  	}
   125  
   126  	js.ThrowCallbackValueNotReturned()
   127  }
   128  
   129  type CreateCallbackFunc func(this js.Ref, createInfo *CreateInfo) js.Ref
   130  
   131  func (fn CreateCallbackFunc) Register() js.Func[func(createInfo *CreateInfo)] {
   132  	return js.RegisterCallback[func(createInfo *CreateInfo)](
   133  		fn, abi.FuncPCABIInternal(fn),
   134  	)
   135  }
   136  
   137  func (fn CreateCallbackFunc) DispatchCallback(
   138  	targetPC uintptr, ctx *js.CallbackContext,
   139  ) {
   140  	args := ctx.Args()
   141  	if len(args) != 1+1 /* js this */ ||
   142  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   143  		js.ThrowInvalidCallbackInvocation()
   144  	}
   145  	var arg0 CreateInfo
   146  	arg0.UpdateFrom(args[0+1])
   147  	defer arg0.FreeMembers(true)
   148  
   149  	if ctx.Return(fn(
   150  		args[0],
   151  
   152  		mark.NoEscape(&arg0),
   153  	)) {
   154  		return
   155  	}
   156  
   157  	js.ThrowCallbackValueNotReturned()
   158  }
   159  
   160  type CreateCallback[T any] struct {
   161  	Fn  func(arg T, this js.Ref, createInfo *CreateInfo) js.Ref
   162  	Arg T
   163  }
   164  
   165  func (cb *CreateCallback[T]) Register() js.Func[func(createInfo *CreateInfo)] {
   166  	return js.RegisterCallback[func(createInfo *CreateInfo)](
   167  		cb, abi.FuncPCABIInternal(cb.Fn),
   168  	)
   169  }
   170  
   171  func (cb *CreateCallback[T]) DispatchCallback(
   172  	targetPC uintptr, ctx *js.CallbackContext,
   173  ) {
   174  	args := ctx.Args()
   175  	if len(args) != 1+1 /* js this */ ||
   176  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   177  		js.ThrowInvalidCallbackInvocation()
   178  	}
   179  	var arg0 CreateInfo
   180  	arg0.UpdateFrom(args[0+1])
   181  	defer arg0.FreeMembers(true)
   182  
   183  	if ctx.Return(cb.Fn(
   184  		cb.Arg,
   185  		args[0],
   186  
   187  		mark.NoEscape(&arg0),
   188  	)) {
   189  		return
   190  	}
   191  
   192  	js.ThrowCallbackValueNotReturned()
   193  }
   194  
   195  type CreateInfo struct {
   196  	// SocketId is "CreateInfo.socketId"
   197  	//
   198  	// Optional
   199  	//
   200  	// NOTE: FFI_USE_SocketId MUST be set to true to make this field effective.
   201  	SocketId int32
   202  
   203  	FFI_USE_SocketId bool // for SocketId.
   204  
   205  	FFI_USE bool
   206  }
   207  
   208  // FromRef calls UpdateFrom and returns a CreateInfo with all fields set.
   209  func (p CreateInfo) FromRef(ref js.Ref) CreateInfo {
   210  	p.UpdateFrom(ref)
   211  	return p
   212  }
   213  
   214  // New creates a new CreateInfo in the application heap.
   215  func (p CreateInfo) New() js.Ref {
   216  	return bindings.CreateInfoJSLoad(
   217  		js.Pointer(&p), js.True, 0,
   218  	)
   219  }
   220  
   221  // UpdateFrom copies value of all fields of the heap object to p.
   222  func (p *CreateInfo) UpdateFrom(ref js.Ref) {
   223  	bindings.CreateInfoJSStore(
   224  		js.Pointer(p), ref,
   225  	)
   226  }
   227  
   228  // Update writes all fields of the p to the heap object referenced by ref.
   229  func (p *CreateInfo) Update(ref js.Ref) {
   230  	bindings.CreateInfoJSLoad(
   231  		js.Pointer(p), js.False, ref,
   232  	)
   233  }
   234  
   235  // FreeMembers frees fields with heap reference, if recursive is true
   236  // free all heap references reachable from p.
   237  func (p *CreateInfo) FreeMembers(recursive bool) {
   238  }
   239  
   240  type DnsQueryType uint32
   241  
   242  const (
   243  	_ DnsQueryType = iota
   244  
   245  	DnsQueryType_ANY
   246  	DnsQueryType_IPV4
   247  	DnsQueryType_IPV6
   248  )
   249  
   250  func (DnsQueryType) FromRef(str js.Ref) DnsQueryType {
   251  	return DnsQueryType(bindings.ConstOfDnsQueryType(str))
   252  }
   253  
   254  func (x DnsQueryType) String() (string, bool) {
   255  	switch x {
   256  	case DnsQueryType_ANY:
   257  		return "any", true
   258  	case DnsQueryType_IPV4:
   259  		return "ipv4", true
   260  	case DnsQueryType_IPV6:
   261  		return "ipv6", true
   262  	default:
   263  		return "", false
   264  	}
   265  }
   266  
   267  type GetInfoCallbackFunc func(this js.Ref, socketInfo *SocketInfo) js.Ref
   268  
   269  func (fn GetInfoCallbackFunc) Register() js.Func[func(socketInfo *SocketInfo)] {
   270  	return js.RegisterCallback[func(socketInfo *SocketInfo)](
   271  		fn, abi.FuncPCABIInternal(fn),
   272  	)
   273  }
   274  
   275  func (fn GetInfoCallbackFunc) DispatchCallback(
   276  	targetPC uintptr, ctx *js.CallbackContext,
   277  ) {
   278  	args := ctx.Args()
   279  	if len(args) != 1+1 /* js this */ ||
   280  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   281  		js.ThrowInvalidCallbackInvocation()
   282  	}
   283  	var arg0 SocketInfo
   284  	arg0.UpdateFrom(args[0+1])
   285  	defer arg0.FreeMembers(true)
   286  
   287  	if ctx.Return(fn(
   288  		args[0],
   289  
   290  		mark.NoEscape(&arg0),
   291  	)) {
   292  		return
   293  	}
   294  
   295  	js.ThrowCallbackValueNotReturned()
   296  }
   297  
   298  type GetInfoCallback[T any] struct {
   299  	Fn  func(arg T, this js.Ref, socketInfo *SocketInfo) js.Ref
   300  	Arg T
   301  }
   302  
   303  func (cb *GetInfoCallback[T]) Register() js.Func[func(socketInfo *SocketInfo)] {
   304  	return js.RegisterCallback[func(socketInfo *SocketInfo)](
   305  		cb, abi.FuncPCABIInternal(cb.Fn),
   306  	)
   307  }
   308  
   309  func (cb *GetInfoCallback[T]) DispatchCallback(
   310  	targetPC uintptr, ctx *js.CallbackContext,
   311  ) {
   312  	args := ctx.Args()
   313  	if len(args) != 1+1 /* js this */ ||
   314  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   315  		js.ThrowInvalidCallbackInvocation()
   316  	}
   317  	var arg0 SocketInfo
   318  	arg0.UpdateFrom(args[0+1])
   319  	defer arg0.FreeMembers(true)
   320  
   321  	if ctx.Return(cb.Fn(
   322  		cb.Arg,
   323  		args[0],
   324  
   325  		mark.NoEscape(&arg0),
   326  	)) {
   327  		return
   328  	}
   329  
   330  	js.ThrowCallbackValueNotReturned()
   331  }
   332  
   333  type SocketInfo struct {
   334  	// SocketId is "SocketInfo.socketId"
   335  	//
   336  	// Optional
   337  	//
   338  	// NOTE: FFI_USE_SocketId MUST be set to true to make this field effective.
   339  	SocketId int32
   340  	// Persistent is "SocketInfo.persistent"
   341  	//
   342  	// Optional
   343  	//
   344  	// NOTE: FFI_USE_Persistent MUST be set to true to make this field effective.
   345  	Persistent bool
   346  	// Name is "SocketInfo.name"
   347  	//
   348  	// Optional
   349  	Name js.String
   350  	// BufferSize is "SocketInfo.bufferSize"
   351  	//
   352  	// Optional
   353  	//
   354  	// NOTE: FFI_USE_BufferSize MUST be set to true to make this field effective.
   355  	BufferSize int32
   356  	// Paused is "SocketInfo.paused"
   357  	//
   358  	// Optional
   359  	//
   360  	// NOTE: FFI_USE_Paused MUST be set to true to make this field effective.
   361  	Paused bool
   362  	// LocalAddress is "SocketInfo.localAddress"
   363  	//
   364  	// Optional
   365  	LocalAddress js.String
   366  	// LocalPort is "SocketInfo.localPort"
   367  	//
   368  	// Optional
   369  	//
   370  	// NOTE: FFI_USE_LocalPort MUST be set to true to make this field effective.
   371  	LocalPort int32
   372  
   373  	FFI_USE_SocketId   bool // for SocketId.
   374  	FFI_USE_Persistent bool // for Persistent.
   375  	FFI_USE_BufferSize bool // for BufferSize.
   376  	FFI_USE_Paused     bool // for Paused.
   377  	FFI_USE_LocalPort  bool // for LocalPort.
   378  
   379  	FFI_USE bool
   380  }
   381  
   382  // FromRef calls UpdateFrom and returns a SocketInfo with all fields set.
   383  func (p SocketInfo) FromRef(ref js.Ref) SocketInfo {
   384  	p.UpdateFrom(ref)
   385  	return p
   386  }
   387  
   388  // New creates a new SocketInfo in the application heap.
   389  func (p SocketInfo) New() js.Ref {
   390  	return bindings.SocketInfoJSLoad(
   391  		js.Pointer(&p), js.True, 0,
   392  	)
   393  }
   394  
   395  // UpdateFrom copies value of all fields of the heap object to p.
   396  func (p *SocketInfo) UpdateFrom(ref js.Ref) {
   397  	bindings.SocketInfoJSStore(
   398  		js.Pointer(p), ref,
   399  	)
   400  }
   401  
   402  // Update writes all fields of the p to the heap object referenced by ref.
   403  func (p *SocketInfo) Update(ref js.Ref) {
   404  	bindings.SocketInfoJSLoad(
   405  		js.Pointer(p), js.False, ref,
   406  	)
   407  }
   408  
   409  // FreeMembers frees fields with heap reference, if recursive is true
   410  // free all heap references reachable from p.
   411  func (p *SocketInfo) FreeMembers(recursive bool) {
   412  	js.Free(
   413  		p.Name.Ref(),
   414  		p.LocalAddress.Ref(),
   415  	)
   416  	p.Name = p.Name.FromRef(js.Undefined)
   417  	p.LocalAddress = p.LocalAddress.FromRef(js.Undefined)
   418  }
   419  
   420  type GetJoinedGroupsCallbackFunc func(this js.Ref, groups js.Array[js.String]) js.Ref
   421  
   422  func (fn GetJoinedGroupsCallbackFunc) Register() js.Func[func(groups js.Array[js.String])] {
   423  	return js.RegisterCallback[func(groups js.Array[js.String])](
   424  		fn, abi.FuncPCABIInternal(fn),
   425  	)
   426  }
   427  
   428  func (fn GetJoinedGroupsCallbackFunc) DispatchCallback(
   429  	targetPC uintptr, ctx *js.CallbackContext,
   430  ) {
   431  	args := ctx.Args()
   432  	if len(args) != 1+1 /* js this */ ||
   433  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   434  		js.ThrowInvalidCallbackInvocation()
   435  	}
   436  
   437  	if ctx.Return(fn(
   438  		args[0],
   439  
   440  		js.Array[js.String]{}.FromRef(args[0+1]),
   441  	)) {
   442  		return
   443  	}
   444  
   445  	js.ThrowCallbackValueNotReturned()
   446  }
   447  
   448  type GetJoinedGroupsCallback[T any] struct {
   449  	Fn  func(arg T, this js.Ref, groups js.Array[js.String]) js.Ref
   450  	Arg T
   451  }
   452  
   453  func (cb *GetJoinedGroupsCallback[T]) Register() js.Func[func(groups js.Array[js.String])] {
   454  	return js.RegisterCallback[func(groups js.Array[js.String])](
   455  		cb, abi.FuncPCABIInternal(cb.Fn),
   456  	)
   457  }
   458  
   459  func (cb *GetJoinedGroupsCallback[T]) DispatchCallback(
   460  	targetPC uintptr, ctx *js.CallbackContext,
   461  ) {
   462  	args := ctx.Args()
   463  	if len(args) != 1+1 /* js this */ ||
   464  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   465  		js.ThrowInvalidCallbackInvocation()
   466  	}
   467  
   468  	if ctx.Return(cb.Fn(
   469  		cb.Arg,
   470  		args[0],
   471  
   472  		js.Array[js.String]{}.FromRef(args[0+1]),
   473  	)) {
   474  		return
   475  	}
   476  
   477  	js.ThrowCallbackValueNotReturned()
   478  }
   479  
   480  type GetSocketsCallbackFunc func(this js.Ref, socketInfos js.Array[SocketInfo]) js.Ref
   481  
   482  func (fn GetSocketsCallbackFunc) Register() js.Func[func(socketInfos js.Array[SocketInfo])] {
   483  	return js.RegisterCallback[func(socketInfos js.Array[SocketInfo])](
   484  		fn, abi.FuncPCABIInternal(fn),
   485  	)
   486  }
   487  
   488  func (fn GetSocketsCallbackFunc) DispatchCallback(
   489  	targetPC uintptr, ctx *js.CallbackContext,
   490  ) {
   491  	args := ctx.Args()
   492  	if len(args) != 1+1 /* js this */ ||
   493  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   494  		js.ThrowInvalidCallbackInvocation()
   495  	}
   496  
   497  	if ctx.Return(fn(
   498  		args[0],
   499  
   500  		js.Array[SocketInfo]{}.FromRef(args[0+1]),
   501  	)) {
   502  		return
   503  	}
   504  
   505  	js.ThrowCallbackValueNotReturned()
   506  }
   507  
   508  type GetSocketsCallback[T any] struct {
   509  	Fn  func(arg T, this js.Ref, socketInfos js.Array[SocketInfo]) js.Ref
   510  	Arg T
   511  }
   512  
   513  func (cb *GetSocketsCallback[T]) Register() js.Func[func(socketInfos js.Array[SocketInfo])] {
   514  	return js.RegisterCallback[func(socketInfos js.Array[SocketInfo])](
   515  		cb, abi.FuncPCABIInternal(cb.Fn),
   516  	)
   517  }
   518  
   519  func (cb *GetSocketsCallback[T]) DispatchCallback(
   520  	targetPC uintptr, ctx *js.CallbackContext,
   521  ) {
   522  	args := ctx.Args()
   523  	if len(args) != 1+1 /* js this */ ||
   524  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   525  		js.ThrowInvalidCallbackInvocation()
   526  	}
   527  
   528  	if ctx.Return(cb.Fn(
   529  		cb.Arg,
   530  		args[0],
   531  
   532  		js.Array[SocketInfo]{}.FromRef(args[0+1]),
   533  	)) {
   534  		return
   535  	}
   536  
   537  	js.ThrowCallbackValueNotReturned()
   538  }
   539  
   540  type JoinGroupCallbackFunc func(this js.Ref, result int32) js.Ref
   541  
   542  func (fn JoinGroupCallbackFunc) Register() js.Func[func(result int32)] {
   543  	return js.RegisterCallback[func(result int32)](
   544  		fn, abi.FuncPCABIInternal(fn),
   545  	)
   546  }
   547  
   548  func (fn JoinGroupCallbackFunc) DispatchCallback(
   549  	targetPC uintptr, ctx *js.CallbackContext,
   550  ) {
   551  	args := ctx.Args()
   552  	if len(args) != 1+1 /* js this */ ||
   553  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   554  		js.ThrowInvalidCallbackInvocation()
   555  	}
   556  
   557  	if ctx.Return(fn(
   558  		args[0],
   559  
   560  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   561  	)) {
   562  		return
   563  	}
   564  
   565  	js.ThrowCallbackValueNotReturned()
   566  }
   567  
   568  type JoinGroupCallback[T any] struct {
   569  	Fn  func(arg T, this js.Ref, result int32) js.Ref
   570  	Arg T
   571  }
   572  
   573  func (cb *JoinGroupCallback[T]) Register() js.Func[func(result int32)] {
   574  	return js.RegisterCallback[func(result int32)](
   575  		cb, abi.FuncPCABIInternal(cb.Fn),
   576  	)
   577  }
   578  
   579  func (cb *JoinGroupCallback[T]) DispatchCallback(
   580  	targetPC uintptr, ctx *js.CallbackContext,
   581  ) {
   582  	args := ctx.Args()
   583  	if len(args) != 1+1 /* js this */ ||
   584  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   585  		js.ThrowInvalidCallbackInvocation()
   586  	}
   587  
   588  	if ctx.Return(cb.Fn(
   589  		cb.Arg,
   590  		args[0],
   591  
   592  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   593  	)) {
   594  		return
   595  	}
   596  
   597  	js.ThrowCallbackValueNotReturned()
   598  }
   599  
   600  type LeaveGroupCallbackFunc func(this js.Ref, result int32) js.Ref
   601  
   602  func (fn LeaveGroupCallbackFunc) Register() js.Func[func(result int32)] {
   603  	return js.RegisterCallback[func(result int32)](
   604  		fn, abi.FuncPCABIInternal(fn),
   605  	)
   606  }
   607  
   608  func (fn LeaveGroupCallbackFunc) DispatchCallback(
   609  	targetPC uintptr, ctx *js.CallbackContext,
   610  ) {
   611  	args := ctx.Args()
   612  	if len(args) != 1+1 /* js this */ ||
   613  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   614  		js.ThrowInvalidCallbackInvocation()
   615  	}
   616  
   617  	if ctx.Return(fn(
   618  		args[0],
   619  
   620  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   621  	)) {
   622  		return
   623  	}
   624  
   625  	js.ThrowCallbackValueNotReturned()
   626  }
   627  
   628  type LeaveGroupCallback[T any] struct {
   629  	Fn  func(arg T, this js.Ref, result int32) js.Ref
   630  	Arg T
   631  }
   632  
   633  func (cb *LeaveGroupCallback[T]) Register() js.Func[func(result int32)] {
   634  	return js.RegisterCallback[func(result int32)](
   635  		cb, abi.FuncPCABIInternal(cb.Fn),
   636  	)
   637  }
   638  
   639  func (cb *LeaveGroupCallback[T]) DispatchCallback(
   640  	targetPC uintptr, ctx *js.CallbackContext,
   641  ) {
   642  	args := ctx.Args()
   643  	if len(args) != 1+1 /* js this */ ||
   644  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   645  		js.ThrowInvalidCallbackInvocation()
   646  	}
   647  
   648  	if ctx.Return(cb.Fn(
   649  		cb.Arg,
   650  		args[0],
   651  
   652  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   653  	)) {
   654  		return
   655  	}
   656  
   657  	js.ThrowCallbackValueNotReturned()
   658  }
   659  
   660  type ReceiveErrorInfo struct {
   661  	// SocketId is "ReceiveErrorInfo.socketId"
   662  	//
   663  	// Optional
   664  	//
   665  	// NOTE: FFI_USE_SocketId MUST be set to true to make this field effective.
   666  	SocketId int32
   667  	// ResultCode is "ReceiveErrorInfo.resultCode"
   668  	//
   669  	// Optional
   670  	//
   671  	// NOTE: FFI_USE_ResultCode MUST be set to true to make this field effective.
   672  	ResultCode int32
   673  
   674  	FFI_USE_SocketId   bool // for SocketId.
   675  	FFI_USE_ResultCode bool // for ResultCode.
   676  
   677  	FFI_USE bool
   678  }
   679  
   680  // FromRef calls UpdateFrom and returns a ReceiveErrorInfo with all fields set.
   681  func (p ReceiveErrorInfo) FromRef(ref js.Ref) ReceiveErrorInfo {
   682  	p.UpdateFrom(ref)
   683  	return p
   684  }
   685  
   686  // New creates a new ReceiveErrorInfo in the application heap.
   687  func (p ReceiveErrorInfo) New() js.Ref {
   688  	return bindings.ReceiveErrorInfoJSLoad(
   689  		js.Pointer(&p), js.True, 0,
   690  	)
   691  }
   692  
   693  // UpdateFrom copies value of all fields of the heap object to p.
   694  func (p *ReceiveErrorInfo) UpdateFrom(ref js.Ref) {
   695  	bindings.ReceiveErrorInfoJSStore(
   696  		js.Pointer(p), ref,
   697  	)
   698  }
   699  
   700  // Update writes all fields of the p to the heap object referenced by ref.
   701  func (p *ReceiveErrorInfo) Update(ref js.Ref) {
   702  	bindings.ReceiveErrorInfoJSLoad(
   703  		js.Pointer(p), js.False, ref,
   704  	)
   705  }
   706  
   707  // FreeMembers frees fields with heap reference, if recursive is true
   708  // free all heap references reachable from p.
   709  func (p *ReceiveErrorInfo) FreeMembers(recursive bool) {
   710  }
   711  
   712  type ReceiveInfo struct {
   713  	// SocketId is "ReceiveInfo.socketId"
   714  	//
   715  	// Optional
   716  	//
   717  	// NOTE: FFI_USE_SocketId MUST be set to true to make this field effective.
   718  	SocketId int32
   719  	// Data is "ReceiveInfo.data"
   720  	//
   721  	// Optional
   722  	Data js.ArrayBuffer
   723  	// RemoteAddress is "ReceiveInfo.remoteAddress"
   724  	//
   725  	// Optional
   726  	RemoteAddress js.String
   727  	// RemotePort is "ReceiveInfo.remotePort"
   728  	//
   729  	// Optional
   730  	//
   731  	// NOTE: FFI_USE_RemotePort MUST be set to true to make this field effective.
   732  	RemotePort int32
   733  
   734  	FFI_USE_SocketId   bool // for SocketId.
   735  	FFI_USE_RemotePort bool // for RemotePort.
   736  
   737  	FFI_USE bool
   738  }
   739  
   740  // FromRef calls UpdateFrom and returns a ReceiveInfo with all fields set.
   741  func (p ReceiveInfo) FromRef(ref js.Ref) ReceiveInfo {
   742  	p.UpdateFrom(ref)
   743  	return p
   744  }
   745  
   746  // New creates a new ReceiveInfo in the application heap.
   747  func (p ReceiveInfo) New() js.Ref {
   748  	return bindings.ReceiveInfoJSLoad(
   749  		js.Pointer(&p), js.True, 0,
   750  	)
   751  }
   752  
   753  // UpdateFrom copies value of all fields of the heap object to p.
   754  func (p *ReceiveInfo) UpdateFrom(ref js.Ref) {
   755  	bindings.ReceiveInfoJSStore(
   756  		js.Pointer(p), ref,
   757  	)
   758  }
   759  
   760  // Update writes all fields of the p to the heap object referenced by ref.
   761  func (p *ReceiveInfo) Update(ref js.Ref) {
   762  	bindings.ReceiveInfoJSLoad(
   763  		js.Pointer(p), js.False, ref,
   764  	)
   765  }
   766  
   767  // FreeMembers frees fields with heap reference, if recursive is true
   768  // free all heap references reachable from p.
   769  func (p *ReceiveInfo) FreeMembers(recursive bool) {
   770  	js.Free(
   771  		p.Data.Ref(),
   772  		p.RemoteAddress.Ref(),
   773  	)
   774  	p.Data = p.Data.FromRef(js.Undefined)
   775  	p.RemoteAddress = p.RemoteAddress.FromRef(js.Undefined)
   776  }
   777  
   778  type SendCallbackFunc func(this js.Ref, sendInfo *SendInfo) js.Ref
   779  
   780  func (fn SendCallbackFunc) Register() js.Func[func(sendInfo *SendInfo)] {
   781  	return js.RegisterCallback[func(sendInfo *SendInfo)](
   782  		fn, abi.FuncPCABIInternal(fn),
   783  	)
   784  }
   785  
   786  func (fn SendCallbackFunc) DispatchCallback(
   787  	targetPC uintptr, ctx *js.CallbackContext,
   788  ) {
   789  	args := ctx.Args()
   790  	if len(args) != 1+1 /* js this */ ||
   791  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   792  		js.ThrowInvalidCallbackInvocation()
   793  	}
   794  	var arg0 SendInfo
   795  	arg0.UpdateFrom(args[0+1])
   796  	defer arg0.FreeMembers(true)
   797  
   798  	if ctx.Return(fn(
   799  		args[0],
   800  
   801  		mark.NoEscape(&arg0),
   802  	)) {
   803  		return
   804  	}
   805  
   806  	js.ThrowCallbackValueNotReturned()
   807  }
   808  
   809  type SendCallback[T any] struct {
   810  	Fn  func(arg T, this js.Ref, sendInfo *SendInfo) js.Ref
   811  	Arg T
   812  }
   813  
   814  func (cb *SendCallback[T]) Register() js.Func[func(sendInfo *SendInfo)] {
   815  	return js.RegisterCallback[func(sendInfo *SendInfo)](
   816  		cb, abi.FuncPCABIInternal(cb.Fn),
   817  	)
   818  }
   819  
   820  func (cb *SendCallback[T]) DispatchCallback(
   821  	targetPC uintptr, ctx *js.CallbackContext,
   822  ) {
   823  	args := ctx.Args()
   824  	if len(args) != 1+1 /* js this */ ||
   825  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   826  		js.ThrowInvalidCallbackInvocation()
   827  	}
   828  	var arg0 SendInfo
   829  	arg0.UpdateFrom(args[0+1])
   830  	defer arg0.FreeMembers(true)
   831  
   832  	if ctx.Return(cb.Fn(
   833  		cb.Arg,
   834  		args[0],
   835  
   836  		mark.NoEscape(&arg0),
   837  	)) {
   838  		return
   839  	}
   840  
   841  	js.ThrowCallbackValueNotReturned()
   842  }
   843  
   844  type SendInfo struct {
   845  	// ResultCode is "SendInfo.resultCode"
   846  	//
   847  	// Optional
   848  	//
   849  	// NOTE: FFI_USE_ResultCode MUST be set to true to make this field effective.
   850  	ResultCode int32
   851  	// BytesSent is "SendInfo.bytesSent"
   852  	//
   853  	// Optional
   854  	//
   855  	// NOTE: FFI_USE_BytesSent MUST be set to true to make this field effective.
   856  	BytesSent int32
   857  
   858  	FFI_USE_ResultCode bool // for ResultCode.
   859  	FFI_USE_BytesSent  bool // for BytesSent.
   860  
   861  	FFI_USE bool
   862  }
   863  
   864  // FromRef calls UpdateFrom and returns a SendInfo with all fields set.
   865  func (p SendInfo) FromRef(ref js.Ref) SendInfo {
   866  	p.UpdateFrom(ref)
   867  	return p
   868  }
   869  
   870  // New creates a new SendInfo in the application heap.
   871  func (p SendInfo) New() js.Ref {
   872  	return bindings.SendInfoJSLoad(
   873  		js.Pointer(&p), js.True, 0,
   874  	)
   875  }
   876  
   877  // UpdateFrom copies value of all fields of the heap object to p.
   878  func (p *SendInfo) UpdateFrom(ref js.Ref) {
   879  	bindings.SendInfoJSStore(
   880  		js.Pointer(p), ref,
   881  	)
   882  }
   883  
   884  // Update writes all fields of the p to the heap object referenced by ref.
   885  func (p *SendInfo) Update(ref js.Ref) {
   886  	bindings.SendInfoJSLoad(
   887  		js.Pointer(p), js.False, ref,
   888  	)
   889  }
   890  
   891  // FreeMembers frees fields with heap reference, if recursive is true
   892  // free all heap references reachable from p.
   893  func (p *SendInfo) FreeMembers(recursive bool) {
   894  }
   895  
   896  type SetBroadcastCallbackFunc func(this js.Ref, result int32) js.Ref
   897  
   898  func (fn SetBroadcastCallbackFunc) Register() js.Func[func(result int32)] {
   899  	return js.RegisterCallback[func(result int32)](
   900  		fn, abi.FuncPCABIInternal(fn),
   901  	)
   902  }
   903  
   904  func (fn SetBroadcastCallbackFunc) DispatchCallback(
   905  	targetPC uintptr, ctx *js.CallbackContext,
   906  ) {
   907  	args := ctx.Args()
   908  	if len(args) != 1+1 /* js this */ ||
   909  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   910  		js.ThrowInvalidCallbackInvocation()
   911  	}
   912  
   913  	if ctx.Return(fn(
   914  		args[0],
   915  
   916  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   917  	)) {
   918  		return
   919  	}
   920  
   921  	js.ThrowCallbackValueNotReturned()
   922  }
   923  
   924  type SetBroadcastCallback[T any] struct {
   925  	Fn  func(arg T, this js.Ref, result int32) js.Ref
   926  	Arg T
   927  }
   928  
   929  func (cb *SetBroadcastCallback[T]) Register() js.Func[func(result int32)] {
   930  	return js.RegisterCallback[func(result int32)](
   931  		cb, abi.FuncPCABIInternal(cb.Fn),
   932  	)
   933  }
   934  
   935  func (cb *SetBroadcastCallback[T]) DispatchCallback(
   936  	targetPC uintptr, ctx *js.CallbackContext,
   937  ) {
   938  	args := ctx.Args()
   939  	if len(args) != 1+1 /* js this */ ||
   940  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   941  		js.ThrowInvalidCallbackInvocation()
   942  	}
   943  
   944  	if ctx.Return(cb.Fn(
   945  		cb.Arg,
   946  		args[0],
   947  
   948  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   949  	)) {
   950  		return
   951  	}
   952  
   953  	js.ThrowCallbackValueNotReturned()
   954  }
   955  
   956  type SetMulticastLoopbackModeCallbackFunc func(this js.Ref, result int32) js.Ref
   957  
   958  func (fn SetMulticastLoopbackModeCallbackFunc) Register() js.Func[func(result int32)] {
   959  	return js.RegisterCallback[func(result int32)](
   960  		fn, abi.FuncPCABIInternal(fn),
   961  	)
   962  }
   963  
   964  func (fn SetMulticastLoopbackModeCallbackFunc) DispatchCallback(
   965  	targetPC uintptr, ctx *js.CallbackContext,
   966  ) {
   967  	args := ctx.Args()
   968  	if len(args) != 1+1 /* js this */ ||
   969  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   970  		js.ThrowInvalidCallbackInvocation()
   971  	}
   972  
   973  	if ctx.Return(fn(
   974  		args[0],
   975  
   976  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   977  	)) {
   978  		return
   979  	}
   980  
   981  	js.ThrowCallbackValueNotReturned()
   982  }
   983  
   984  type SetMulticastLoopbackModeCallback[T any] struct {
   985  	Fn  func(arg T, this js.Ref, result int32) js.Ref
   986  	Arg T
   987  }
   988  
   989  func (cb *SetMulticastLoopbackModeCallback[T]) Register() js.Func[func(result int32)] {
   990  	return js.RegisterCallback[func(result int32)](
   991  		cb, abi.FuncPCABIInternal(cb.Fn),
   992  	)
   993  }
   994  
   995  func (cb *SetMulticastLoopbackModeCallback[T]) DispatchCallback(
   996  	targetPC uintptr, ctx *js.CallbackContext,
   997  ) {
   998  	args := ctx.Args()
   999  	if len(args) != 1+1 /* js this */ ||
  1000  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1001  		js.ThrowInvalidCallbackInvocation()
  1002  	}
  1003  
  1004  	if ctx.Return(cb.Fn(
  1005  		cb.Arg,
  1006  		args[0],
  1007  
  1008  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  1009  	)) {
  1010  		return
  1011  	}
  1012  
  1013  	js.ThrowCallbackValueNotReturned()
  1014  }
  1015  
  1016  type SetMulticastTimeToLiveCallbackFunc func(this js.Ref, result int32) js.Ref
  1017  
  1018  func (fn SetMulticastTimeToLiveCallbackFunc) Register() js.Func[func(result int32)] {
  1019  	return js.RegisterCallback[func(result int32)](
  1020  		fn, abi.FuncPCABIInternal(fn),
  1021  	)
  1022  }
  1023  
  1024  func (fn SetMulticastTimeToLiveCallbackFunc) DispatchCallback(
  1025  	targetPC uintptr, ctx *js.CallbackContext,
  1026  ) {
  1027  	args := ctx.Args()
  1028  	if len(args) != 1+1 /* js this */ ||
  1029  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1030  		js.ThrowInvalidCallbackInvocation()
  1031  	}
  1032  
  1033  	if ctx.Return(fn(
  1034  		args[0],
  1035  
  1036  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  1037  	)) {
  1038  		return
  1039  	}
  1040  
  1041  	js.ThrowCallbackValueNotReturned()
  1042  }
  1043  
  1044  type SetMulticastTimeToLiveCallback[T any] struct {
  1045  	Fn  func(arg T, this js.Ref, result int32) js.Ref
  1046  	Arg T
  1047  }
  1048  
  1049  func (cb *SetMulticastTimeToLiveCallback[T]) Register() js.Func[func(result int32)] {
  1050  	return js.RegisterCallback[func(result int32)](
  1051  		cb, abi.FuncPCABIInternal(cb.Fn),
  1052  	)
  1053  }
  1054  
  1055  func (cb *SetMulticastTimeToLiveCallback[T]) DispatchCallback(
  1056  	targetPC uintptr, ctx *js.CallbackContext,
  1057  ) {
  1058  	args := ctx.Args()
  1059  	if len(args) != 1+1 /* js this */ ||
  1060  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1061  		js.ThrowInvalidCallbackInvocation()
  1062  	}
  1063  
  1064  	if ctx.Return(cb.Fn(
  1065  		cb.Arg,
  1066  		args[0],
  1067  
  1068  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  1069  	)) {
  1070  		return
  1071  	}
  1072  
  1073  	js.ThrowCallbackValueNotReturned()
  1074  }
  1075  
  1076  type SetPausedCallbackFunc func(this js.Ref) js.Ref
  1077  
  1078  func (fn SetPausedCallbackFunc) Register() js.Func[func()] {
  1079  	return js.RegisterCallback[func()](
  1080  		fn, abi.FuncPCABIInternal(fn),
  1081  	)
  1082  }
  1083  
  1084  func (fn SetPausedCallbackFunc) DispatchCallback(
  1085  	targetPC uintptr, ctx *js.CallbackContext,
  1086  ) {
  1087  	args := ctx.Args()
  1088  	if len(args) != 0+1 /* js this */ ||
  1089  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1090  		js.ThrowInvalidCallbackInvocation()
  1091  	}
  1092  
  1093  	if ctx.Return(fn(
  1094  		args[0],
  1095  	)) {
  1096  		return
  1097  	}
  1098  
  1099  	js.ThrowCallbackValueNotReturned()
  1100  }
  1101  
  1102  type SetPausedCallback[T any] struct {
  1103  	Fn  func(arg T, this js.Ref) js.Ref
  1104  	Arg T
  1105  }
  1106  
  1107  func (cb *SetPausedCallback[T]) Register() js.Func[func()] {
  1108  	return js.RegisterCallback[func()](
  1109  		cb, abi.FuncPCABIInternal(cb.Fn),
  1110  	)
  1111  }
  1112  
  1113  func (cb *SetPausedCallback[T]) DispatchCallback(
  1114  	targetPC uintptr, ctx *js.CallbackContext,
  1115  ) {
  1116  	args := ctx.Args()
  1117  	if len(args) != 0+1 /* js this */ ||
  1118  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1119  		js.ThrowInvalidCallbackInvocation()
  1120  	}
  1121  
  1122  	if ctx.Return(cb.Fn(
  1123  		cb.Arg,
  1124  		args[0],
  1125  	)) {
  1126  		return
  1127  	}
  1128  
  1129  	js.ThrowCallbackValueNotReturned()
  1130  }
  1131  
  1132  type SocketProperties struct {
  1133  	// Persistent is "SocketProperties.persistent"
  1134  	//
  1135  	// Optional
  1136  	//
  1137  	// NOTE: FFI_USE_Persistent MUST be set to true to make this field effective.
  1138  	Persistent bool
  1139  	// Name is "SocketProperties.name"
  1140  	//
  1141  	// Optional
  1142  	Name js.String
  1143  	// BufferSize is "SocketProperties.bufferSize"
  1144  	//
  1145  	// Optional
  1146  	//
  1147  	// NOTE: FFI_USE_BufferSize MUST be set to true to make this field effective.
  1148  	BufferSize int32
  1149  
  1150  	FFI_USE_Persistent bool // for Persistent.
  1151  	FFI_USE_BufferSize bool // for BufferSize.
  1152  
  1153  	FFI_USE bool
  1154  }
  1155  
  1156  // FromRef calls UpdateFrom and returns a SocketProperties with all fields set.
  1157  func (p SocketProperties) FromRef(ref js.Ref) SocketProperties {
  1158  	p.UpdateFrom(ref)
  1159  	return p
  1160  }
  1161  
  1162  // New creates a new SocketProperties in the application heap.
  1163  func (p SocketProperties) New() js.Ref {
  1164  	return bindings.SocketPropertiesJSLoad(
  1165  		js.Pointer(&p), js.True, 0,
  1166  	)
  1167  }
  1168  
  1169  // UpdateFrom copies value of all fields of the heap object to p.
  1170  func (p *SocketProperties) UpdateFrom(ref js.Ref) {
  1171  	bindings.SocketPropertiesJSStore(
  1172  		js.Pointer(p), ref,
  1173  	)
  1174  }
  1175  
  1176  // Update writes all fields of the p to the heap object referenced by ref.
  1177  func (p *SocketProperties) Update(ref js.Ref) {
  1178  	bindings.SocketPropertiesJSLoad(
  1179  		js.Pointer(p), js.False, ref,
  1180  	)
  1181  }
  1182  
  1183  // FreeMembers frees fields with heap reference, if recursive is true
  1184  // free all heap references reachable from p.
  1185  func (p *SocketProperties) FreeMembers(recursive bool) {
  1186  	js.Free(
  1187  		p.Name.Ref(),
  1188  	)
  1189  	p.Name = p.Name.FromRef(js.Undefined)
  1190  }
  1191  
  1192  type UpdateCallbackFunc func(this js.Ref) js.Ref
  1193  
  1194  func (fn UpdateCallbackFunc) Register() js.Func[func()] {
  1195  	return js.RegisterCallback[func()](
  1196  		fn, abi.FuncPCABIInternal(fn),
  1197  	)
  1198  }
  1199  
  1200  func (fn UpdateCallbackFunc) DispatchCallback(
  1201  	targetPC uintptr, ctx *js.CallbackContext,
  1202  ) {
  1203  	args := ctx.Args()
  1204  	if len(args) != 0+1 /* js this */ ||
  1205  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1206  		js.ThrowInvalidCallbackInvocation()
  1207  	}
  1208  
  1209  	if ctx.Return(fn(
  1210  		args[0],
  1211  	)) {
  1212  		return
  1213  	}
  1214  
  1215  	js.ThrowCallbackValueNotReturned()
  1216  }
  1217  
  1218  type UpdateCallback[T any] struct {
  1219  	Fn  func(arg T, this js.Ref) js.Ref
  1220  	Arg T
  1221  }
  1222  
  1223  func (cb *UpdateCallback[T]) Register() js.Func[func()] {
  1224  	return js.RegisterCallback[func()](
  1225  		cb, abi.FuncPCABIInternal(cb.Fn),
  1226  	)
  1227  }
  1228  
  1229  func (cb *UpdateCallback[T]) DispatchCallback(
  1230  	targetPC uintptr, ctx *js.CallbackContext,
  1231  ) {
  1232  	args := ctx.Args()
  1233  	if len(args) != 0+1 /* js this */ ||
  1234  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1235  		js.ThrowInvalidCallbackInvocation()
  1236  	}
  1237  
  1238  	if ctx.Return(cb.Fn(
  1239  		cb.Arg,
  1240  		args[0],
  1241  	)) {
  1242  		return
  1243  	}
  1244  
  1245  	js.ThrowCallbackValueNotReturned()
  1246  }
  1247  
  1248  // HasFuncBind returns true if the function "WEBEXT.sockets.udp.bind" exists.
  1249  func HasFuncBind() bool {
  1250  	return js.True == bindings.HasFuncBind()
  1251  }
  1252  
  1253  // FuncBind returns the function "WEBEXT.sockets.udp.bind".
  1254  func FuncBind() (fn js.Func[func(socketId int32, address js.String, port int32, callback js.Func[func(result int32)])]) {
  1255  	bindings.FuncBind(
  1256  		js.Pointer(&fn),
  1257  	)
  1258  	return
  1259  }
  1260  
  1261  // Bind calls the function "WEBEXT.sockets.udp.bind" directly.
  1262  func Bind(socketId int32, address js.String, port int32, callback js.Func[func(result int32)]) (ret js.Void) {
  1263  	bindings.CallBind(
  1264  		js.Pointer(&ret),
  1265  		int32(socketId),
  1266  		address.Ref(),
  1267  		int32(port),
  1268  		callback.Ref(),
  1269  	)
  1270  
  1271  	return
  1272  }
  1273  
  1274  // TryBind calls the function "WEBEXT.sockets.udp.bind"
  1275  // in a try/catch block and returns (_, err, ok = false) when it went through
  1276  // the catch clause.
  1277  func TryBind(socketId int32, address js.String, port int32, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  1278  	ok = js.True == bindings.TryBind(
  1279  		js.Pointer(&ret), js.Pointer(&exception),
  1280  		int32(socketId),
  1281  		address.Ref(),
  1282  		int32(port),
  1283  		callback.Ref(),
  1284  	)
  1285  
  1286  	return
  1287  }
  1288  
  1289  // HasFuncClose returns true if the function "WEBEXT.sockets.udp.close" exists.
  1290  func HasFuncClose() bool {
  1291  	return js.True == bindings.HasFuncClose()
  1292  }
  1293  
  1294  // FuncClose returns the function "WEBEXT.sockets.udp.close".
  1295  func FuncClose() (fn js.Func[func(socketId int32, callback js.Func[func()])]) {
  1296  	bindings.FuncClose(
  1297  		js.Pointer(&fn),
  1298  	)
  1299  	return
  1300  }
  1301  
  1302  // Close calls the function "WEBEXT.sockets.udp.close" directly.
  1303  func Close(socketId int32, callback js.Func[func()]) (ret js.Void) {
  1304  	bindings.CallClose(
  1305  		js.Pointer(&ret),
  1306  		int32(socketId),
  1307  		callback.Ref(),
  1308  	)
  1309  
  1310  	return
  1311  }
  1312  
  1313  // TryClose calls the function "WEBEXT.sockets.udp.close"
  1314  // in a try/catch block and returns (_, err, ok = false) when it went through
  1315  // the catch clause.
  1316  func TryClose(socketId int32, callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
  1317  	ok = js.True == bindings.TryClose(
  1318  		js.Pointer(&ret), js.Pointer(&exception),
  1319  		int32(socketId),
  1320  		callback.Ref(),
  1321  	)
  1322  
  1323  	return
  1324  }
  1325  
  1326  // HasFuncCreate returns true if the function "WEBEXT.sockets.udp.create" exists.
  1327  func HasFuncCreate() bool {
  1328  	return js.True == bindings.HasFuncCreate()
  1329  }
  1330  
  1331  // FuncCreate returns the function "WEBEXT.sockets.udp.create".
  1332  func FuncCreate() (fn js.Func[func(properties SocketProperties, callback js.Func[func(createInfo *CreateInfo)])]) {
  1333  	bindings.FuncCreate(
  1334  		js.Pointer(&fn),
  1335  	)
  1336  	return
  1337  }
  1338  
  1339  // Create calls the function "WEBEXT.sockets.udp.create" directly.
  1340  func Create(properties SocketProperties, callback js.Func[func(createInfo *CreateInfo)]) (ret js.Void) {
  1341  	bindings.CallCreate(
  1342  		js.Pointer(&ret),
  1343  		js.Pointer(&properties),
  1344  		callback.Ref(),
  1345  	)
  1346  
  1347  	return
  1348  }
  1349  
  1350  // TryCreate calls the function "WEBEXT.sockets.udp.create"
  1351  // in a try/catch block and returns (_, err, ok = false) when it went through
  1352  // the catch clause.
  1353  func TryCreate(properties SocketProperties, callback js.Func[func(createInfo *CreateInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1354  	ok = js.True == bindings.TryCreate(
  1355  		js.Pointer(&ret), js.Pointer(&exception),
  1356  		js.Pointer(&properties),
  1357  		callback.Ref(),
  1358  	)
  1359  
  1360  	return
  1361  }
  1362  
  1363  // HasFuncGetInfo returns true if the function "WEBEXT.sockets.udp.getInfo" exists.
  1364  func HasFuncGetInfo() bool {
  1365  	return js.True == bindings.HasFuncGetInfo()
  1366  }
  1367  
  1368  // FuncGetInfo returns the function "WEBEXT.sockets.udp.getInfo".
  1369  func FuncGetInfo() (fn js.Func[func(socketId int32, callback js.Func[func(socketInfo *SocketInfo)])]) {
  1370  	bindings.FuncGetInfo(
  1371  		js.Pointer(&fn),
  1372  	)
  1373  	return
  1374  }
  1375  
  1376  // GetInfo calls the function "WEBEXT.sockets.udp.getInfo" directly.
  1377  func GetInfo(socketId int32, callback js.Func[func(socketInfo *SocketInfo)]) (ret js.Void) {
  1378  	bindings.CallGetInfo(
  1379  		js.Pointer(&ret),
  1380  		int32(socketId),
  1381  		callback.Ref(),
  1382  	)
  1383  
  1384  	return
  1385  }
  1386  
  1387  // TryGetInfo calls the function "WEBEXT.sockets.udp.getInfo"
  1388  // in a try/catch block and returns (_, err, ok = false) when it went through
  1389  // the catch clause.
  1390  func TryGetInfo(socketId int32, callback js.Func[func(socketInfo *SocketInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1391  	ok = js.True == bindings.TryGetInfo(
  1392  		js.Pointer(&ret), js.Pointer(&exception),
  1393  		int32(socketId),
  1394  		callback.Ref(),
  1395  	)
  1396  
  1397  	return
  1398  }
  1399  
  1400  // HasFuncGetJoinedGroups returns true if the function "WEBEXT.sockets.udp.getJoinedGroups" exists.
  1401  func HasFuncGetJoinedGroups() bool {
  1402  	return js.True == bindings.HasFuncGetJoinedGroups()
  1403  }
  1404  
  1405  // FuncGetJoinedGroups returns the function "WEBEXT.sockets.udp.getJoinedGroups".
  1406  func FuncGetJoinedGroups() (fn js.Func[func(socketId int32, callback js.Func[func(groups js.Array[js.String])])]) {
  1407  	bindings.FuncGetJoinedGroups(
  1408  		js.Pointer(&fn),
  1409  	)
  1410  	return
  1411  }
  1412  
  1413  // GetJoinedGroups calls the function "WEBEXT.sockets.udp.getJoinedGroups" directly.
  1414  func GetJoinedGroups(socketId int32, callback js.Func[func(groups js.Array[js.String])]) (ret js.Void) {
  1415  	bindings.CallGetJoinedGroups(
  1416  		js.Pointer(&ret),
  1417  		int32(socketId),
  1418  		callback.Ref(),
  1419  	)
  1420  
  1421  	return
  1422  }
  1423  
  1424  // TryGetJoinedGroups calls the function "WEBEXT.sockets.udp.getJoinedGroups"
  1425  // in a try/catch block and returns (_, err, ok = false) when it went through
  1426  // the catch clause.
  1427  func TryGetJoinedGroups(socketId int32, callback js.Func[func(groups js.Array[js.String])]) (ret js.Void, exception js.Any, ok bool) {
  1428  	ok = js.True == bindings.TryGetJoinedGroups(
  1429  		js.Pointer(&ret), js.Pointer(&exception),
  1430  		int32(socketId),
  1431  		callback.Ref(),
  1432  	)
  1433  
  1434  	return
  1435  }
  1436  
  1437  // HasFuncGetSockets returns true if the function "WEBEXT.sockets.udp.getSockets" exists.
  1438  func HasFuncGetSockets() bool {
  1439  	return js.True == bindings.HasFuncGetSockets()
  1440  }
  1441  
  1442  // FuncGetSockets returns the function "WEBEXT.sockets.udp.getSockets".
  1443  func FuncGetSockets() (fn js.Func[func(callback js.Func[func(socketInfos js.Array[SocketInfo])])]) {
  1444  	bindings.FuncGetSockets(
  1445  		js.Pointer(&fn),
  1446  	)
  1447  	return
  1448  }
  1449  
  1450  // GetSockets calls the function "WEBEXT.sockets.udp.getSockets" directly.
  1451  func GetSockets(callback js.Func[func(socketInfos js.Array[SocketInfo])]) (ret js.Void) {
  1452  	bindings.CallGetSockets(
  1453  		js.Pointer(&ret),
  1454  		callback.Ref(),
  1455  	)
  1456  
  1457  	return
  1458  }
  1459  
  1460  // TryGetSockets calls the function "WEBEXT.sockets.udp.getSockets"
  1461  // in a try/catch block and returns (_, err, ok = false) when it went through
  1462  // the catch clause.
  1463  func TryGetSockets(callback js.Func[func(socketInfos js.Array[SocketInfo])]) (ret js.Void, exception js.Any, ok bool) {
  1464  	ok = js.True == bindings.TryGetSockets(
  1465  		js.Pointer(&ret), js.Pointer(&exception),
  1466  		callback.Ref(),
  1467  	)
  1468  
  1469  	return
  1470  }
  1471  
  1472  // HasFuncJoinGroup returns true if the function "WEBEXT.sockets.udp.joinGroup" exists.
  1473  func HasFuncJoinGroup() bool {
  1474  	return js.True == bindings.HasFuncJoinGroup()
  1475  }
  1476  
  1477  // FuncJoinGroup returns the function "WEBEXT.sockets.udp.joinGroup".
  1478  func FuncJoinGroup() (fn js.Func[func(socketId int32, address js.String, callback js.Func[func(result int32)])]) {
  1479  	bindings.FuncJoinGroup(
  1480  		js.Pointer(&fn),
  1481  	)
  1482  	return
  1483  }
  1484  
  1485  // JoinGroup calls the function "WEBEXT.sockets.udp.joinGroup" directly.
  1486  func JoinGroup(socketId int32, address js.String, callback js.Func[func(result int32)]) (ret js.Void) {
  1487  	bindings.CallJoinGroup(
  1488  		js.Pointer(&ret),
  1489  		int32(socketId),
  1490  		address.Ref(),
  1491  		callback.Ref(),
  1492  	)
  1493  
  1494  	return
  1495  }
  1496  
  1497  // TryJoinGroup calls the function "WEBEXT.sockets.udp.joinGroup"
  1498  // in a try/catch block and returns (_, err, ok = false) when it went through
  1499  // the catch clause.
  1500  func TryJoinGroup(socketId int32, address js.String, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  1501  	ok = js.True == bindings.TryJoinGroup(
  1502  		js.Pointer(&ret), js.Pointer(&exception),
  1503  		int32(socketId),
  1504  		address.Ref(),
  1505  		callback.Ref(),
  1506  	)
  1507  
  1508  	return
  1509  }
  1510  
  1511  // HasFuncLeaveGroup returns true if the function "WEBEXT.sockets.udp.leaveGroup" exists.
  1512  func HasFuncLeaveGroup() bool {
  1513  	return js.True == bindings.HasFuncLeaveGroup()
  1514  }
  1515  
  1516  // FuncLeaveGroup returns the function "WEBEXT.sockets.udp.leaveGroup".
  1517  func FuncLeaveGroup() (fn js.Func[func(socketId int32, address js.String, callback js.Func[func(result int32)])]) {
  1518  	bindings.FuncLeaveGroup(
  1519  		js.Pointer(&fn),
  1520  	)
  1521  	return
  1522  }
  1523  
  1524  // LeaveGroup calls the function "WEBEXT.sockets.udp.leaveGroup" directly.
  1525  func LeaveGroup(socketId int32, address js.String, callback js.Func[func(result int32)]) (ret js.Void) {
  1526  	bindings.CallLeaveGroup(
  1527  		js.Pointer(&ret),
  1528  		int32(socketId),
  1529  		address.Ref(),
  1530  		callback.Ref(),
  1531  	)
  1532  
  1533  	return
  1534  }
  1535  
  1536  // TryLeaveGroup calls the function "WEBEXT.sockets.udp.leaveGroup"
  1537  // in a try/catch block and returns (_, err, ok = false) when it went through
  1538  // the catch clause.
  1539  func TryLeaveGroup(socketId int32, address js.String, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  1540  	ok = js.True == bindings.TryLeaveGroup(
  1541  		js.Pointer(&ret), js.Pointer(&exception),
  1542  		int32(socketId),
  1543  		address.Ref(),
  1544  		callback.Ref(),
  1545  	)
  1546  
  1547  	return
  1548  }
  1549  
  1550  type OnReceiveEventCallbackFunc func(this js.Ref, info *ReceiveInfo) js.Ref
  1551  
  1552  func (fn OnReceiveEventCallbackFunc) Register() js.Func[func(info *ReceiveInfo)] {
  1553  	return js.RegisterCallback[func(info *ReceiveInfo)](
  1554  		fn, abi.FuncPCABIInternal(fn),
  1555  	)
  1556  }
  1557  
  1558  func (fn OnReceiveEventCallbackFunc) DispatchCallback(
  1559  	targetPC uintptr, ctx *js.CallbackContext,
  1560  ) {
  1561  	args := ctx.Args()
  1562  	if len(args) != 1+1 /* js this */ ||
  1563  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1564  		js.ThrowInvalidCallbackInvocation()
  1565  	}
  1566  	var arg0 ReceiveInfo
  1567  	arg0.UpdateFrom(args[0+1])
  1568  	defer arg0.FreeMembers(true)
  1569  
  1570  	if ctx.Return(fn(
  1571  		args[0],
  1572  
  1573  		mark.NoEscape(&arg0),
  1574  	)) {
  1575  		return
  1576  	}
  1577  
  1578  	js.ThrowCallbackValueNotReturned()
  1579  }
  1580  
  1581  type OnReceiveEventCallback[T any] struct {
  1582  	Fn  func(arg T, this js.Ref, info *ReceiveInfo) js.Ref
  1583  	Arg T
  1584  }
  1585  
  1586  func (cb *OnReceiveEventCallback[T]) Register() js.Func[func(info *ReceiveInfo)] {
  1587  	return js.RegisterCallback[func(info *ReceiveInfo)](
  1588  		cb, abi.FuncPCABIInternal(cb.Fn),
  1589  	)
  1590  }
  1591  
  1592  func (cb *OnReceiveEventCallback[T]) DispatchCallback(
  1593  	targetPC uintptr, ctx *js.CallbackContext,
  1594  ) {
  1595  	args := ctx.Args()
  1596  	if len(args) != 1+1 /* js this */ ||
  1597  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1598  		js.ThrowInvalidCallbackInvocation()
  1599  	}
  1600  	var arg0 ReceiveInfo
  1601  	arg0.UpdateFrom(args[0+1])
  1602  	defer arg0.FreeMembers(true)
  1603  
  1604  	if ctx.Return(cb.Fn(
  1605  		cb.Arg,
  1606  		args[0],
  1607  
  1608  		mark.NoEscape(&arg0),
  1609  	)) {
  1610  		return
  1611  	}
  1612  
  1613  	js.ThrowCallbackValueNotReturned()
  1614  }
  1615  
  1616  // HasFuncOnReceive returns true if the function "WEBEXT.sockets.udp.onReceive.addListener" exists.
  1617  func HasFuncOnReceive() bool {
  1618  	return js.True == bindings.HasFuncOnReceive()
  1619  }
  1620  
  1621  // FuncOnReceive returns the function "WEBEXT.sockets.udp.onReceive.addListener".
  1622  func FuncOnReceive() (fn js.Func[func(callback js.Func[func(info *ReceiveInfo)])]) {
  1623  	bindings.FuncOnReceive(
  1624  		js.Pointer(&fn),
  1625  	)
  1626  	return
  1627  }
  1628  
  1629  // OnReceive calls the function "WEBEXT.sockets.udp.onReceive.addListener" directly.
  1630  func OnReceive(callback js.Func[func(info *ReceiveInfo)]) (ret js.Void) {
  1631  	bindings.CallOnReceive(
  1632  		js.Pointer(&ret),
  1633  		callback.Ref(),
  1634  	)
  1635  
  1636  	return
  1637  }
  1638  
  1639  // TryOnReceive calls the function "WEBEXT.sockets.udp.onReceive.addListener"
  1640  // in a try/catch block and returns (_, err, ok = false) when it went through
  1641  // the catch clause.
  1642  func TryOnReceive(callback js.Func[func(info *ReceiveInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1643  	ok = js.True == bindings.TryOnReceive(
  1644  		js.Pointer(&ret), js.Pointer(&exception),
  1645  		callback.Ref(),
  1646  	)
  1647  
  1648  	return
  1649  }
  1650  
  1651  // HasFuncOffReceive returns true if the function "WEBEXT.sockets.udp.onReceive.removeListener" exists.
  1652  func HasFuncOffReceive() bool {
  1653  	return js.True == bindings.HasFuncOffReceive()
  1654  }
  1655  
  1656  // FuncOffReceive returns the function "WEBEXT.sockets.udp.onReceive.removeListener".
  1657  func FuncOffReceive() (fn js.Func[func(callback js.Func[func(info *ReceiveInfo)])]) {
  1658  	bindings.FuncOffReceive(
  1659  		js.Pointer(&fn),
  1660  	)
  1661  	return
  1662  }
  1663  
  1664  // OffReceive calls the function "WEBEXT.sockets.udp.onReceive.removeListener" directly.
  1665  func OffReceive(callback js.Func[func(info *ReceiveInfo)]) (ret js.Void) {
  1666  	bindings.CallOffReceive(
  1667  		js.Pointer(&ret),
  1668  		callback.Ref(),
  1669  	)
  1670  
  1671  	return
  1672  }
  1673  
  1674  // TryOffReceive calls the function "WEBEXT.sockets.udp.onReceive.removeListener"
  1675  // in a try/catch block and returns (_, err, ok = false) when it went through
  1676  // the catch clause.
  1677  func TryOffReceive(callback js.Func[func(info *ReceiveInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1678  	ok = js.True == bindings.TryOffReceive(
  1679  		js.Pointer(&ret), js.Pointer(&exception),
  1680  		callback.Ref(),
  1681  	)
  1682  
  1683  	return
  1684  }
  1685  
  1686  // HasFuncHasOnReceive returns true if the function "WEBEXT.sockets.udp.onReceive.hasListener" exists.
  1687  func HasFuncHasOnReceive() bool {
  1688  	return js.True == bindings.HasFuncHasOnReceive()
  1689  }
  1690  
  1691  // FuncHasOnReceive returns the function "WEBEXT.sockets.udp.onReceive.hasListener".
  1692  func FuncHasOnReceive() (fn js.Func[func(callback js.Func[func(info *ReceiveInfo)]) bool]) {
  1693  	bindings.FuncHasOnReceive(
  1694  		js.Pointer(&fn),
  1695  	)
  1696  	return
  1697  }
  1698  
  1699  // HasOnReceive calls the function "WEBEXT.sockets.udp.onReceive.hasListener" directly.
  1700  func HasOnReceive(callback js.Func[func(info *ReceiveInfo)]) (ret bool) {
  1701  	bindings.CallHasOnReceive(
  1702  		js.Pointer(&ret),
  1703  		callback.Ref(),
  1704  	)
  1705  
  1706  	return
  1707  }
  1708  
  1709  // TryHasOnReceive calls the function "WEBEXT.sockets.udp.onReceive.hasListener"
  1710  // in a try/catch block and returns (_, err, ok = false) when it went through
  1711  // the catch clause.
  1712  func TryHasOnReceive(callback js.Func[func(info *ReceiveInfo)]) (ret bool, exception js.Any, ok bool) {
  1713  	ok = js.True == bindings.TryHasOnReceive(
  1714  		js.Pointer(&ret), js.Pointer(&exception),
  1715  		callback.Ref(),
  1716  	)
  1717  
  1718  	return
  1719  }
  1720  
  1721  type OnReceiveErrorEventCallbackFunc func(this js.Ref, info *ReceiveErrorInfo) js.Ref
  1722  
  1723  func (fn OnReceiveErrorEventCallbackFunc) Register() js.Func[func(info *ReceiveErrorInfo)] {
  1724  	return js.RegisterCallback[func(info *ReceiveErrorInfo)](
  1725  		fn, abi.FuncPCABIInternal(fn),
  1726  	)
  1727  }
  1728  
  1729  func (fn OnReceiveErrorEventCallbackFunc) DispatchCallback(
  1730  	targetPC uintptr, ctx *js.CallbackContext,
  1731  ) {
  1732  	args := ctx.Args()
  1733  	if len(args) != 1+1 /* js this */ ||
  1734  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1735  		js.ThrowInvalidCallbackInvocation()
  1736  	}
  1737  	var arg0 ReceiveErrorInfo
  1738  	arg0.UpdateFrom(args[0+1])
  1739  	defer arg0.FreeMembers(true)
  1740  
  1741  	if ctx.Return(fn(
  1742  		args[0],
  1743  
  1744  		mark.NoEscape(&arg0),
  1745  	)) {
  1746  		return
  1747  	}
  1748  
  1749  	js.ThrowCallbackValueNotReturned()
  1750  }
  1751  
  1752  type OnReceiveErrorEventCallback[T any] struct {
  1753  	Fn  func(arg T, this js.Ref, info *ReceiveErrorInfo) js.Ref
  1754  	Arg T
  1755  }
  1756  
  1757  func (cb *OnReceiveErrorEventCallback[T]) Register() js.Func[func(info *ReceiveErrorInfo)] {
  1758  	return js.RegisterCallback[func(info *ReceiveErrorInfo)](
  1759  		cb, abi.FuncPCABIInternal(cb.Fn),
  1760  	)
  1761  }
  1762  
  1763  func (cb *OnReceiveErrorEventCallback[T]) DispatchCallback(
  1764  	targetPC uintptr, ctx *js.CallbackContext,
  1765  ) {
  1766  	args := ctx.Args()
  1767  	if len(args) != 1+1 /* js this */ ||
  1768  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1769  		js.ThrowInvalidCallbackInvocation()
  1770  	}
  1771  	var arg0 ReceiveErrorInfo
  1772  	arg0.UpdateFrom(args[0+1])
  1773  	defer arg0.FreeMembers(true)
  1774  
  1775  	if ctx.Return(cb.Fn(
  1776  		cb.Arg,
  1777  		args[0],
  1778  
  1779  		mark.NoEscape(&arg0),
  1780  	)) {
  1781  		return
  1782  	}
  1783  
  1784  	js.ThrowCallbackValueNotReturned()
  1785  }
  1786  
  1787  // HasFuncOnReceiveError returns true if the function "WEBEXT.sockets.udp.onReceiveError.addListener" exists.
  1788  func HasFuncOnReceiveError() bool {
  1789  	return js.True == bindings.HasFuncOnReceiveError()
  1790  }
  1791  
  1792  // FuncOnReceiveError returns the function "WEBEXT.sockets.udp.onReceiveError.addListener".
  1793  func FuncOnReceiveError() (fn js.Func[func(callback js.Func[func(info *ReceiveErrorInfo)])]) {
  1794  	bindings.FuncOnReceiveError(
  1795  		js.Pointer(&fn),
  1796  	)
  1797  	return
  1798  }
  1799  
  1800  // OnReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.addListener" directly.
  1801  func OnReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret js.Void) {
  1802  	bindings.CallOnReceiveError(
  1803  		js.Pointer(&ret),
  1804  		callback.Ref(),
  1805  	)
  1806  
  1807  	return
  1808  }
  1809  
  1810  // TryOnReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.addListener"
  1811  // in a try/catch block and returns (_, err, ok = false) when it went through
  1812  // the catch clause.
  1813  func TryOnReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1814  	ok = js.True == bindings.TryOnReceiveError(
  1815  		js.Pointer(&ret), js.Pointer(&exception),
  1816  		callback.Ref(),
  1817  	)
  1818  
  1819  	return
  1820  }
  1821  
  1822  // HasFuncOffReceiveError returns true if the function "WEBEXT.sockets.udp.onReceiveError.removeListener" exists.
  1823  func HasFuncOffReceiveError() bool {
  1824  	return js.True == bindings.HasFuncOffReceiveError()
  1825  }
  1826  
  1827  // FuncOffReceiveError returns the function "WEBEXT.sockets.udp.onReceiveError.removeListener".
  1828  func FuncOffReceiveError() (fn js.Func[func(callback js.Func[func(info *ReceiveErrorInfo)])]) {
  1829  	bindings.FuncOffReceiveError(
  1830  		js.Pointer(&fn),
  1831  	)
  1832  	return
  1833  }
  1834  
  1835  // OffReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.removeListener" directly.
  1836  func OffReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret js.Void) {
  1837  	bindings.CallOffReceiveError(
  1838  		js.Pointer(&ret),
  1839  		callback.Ref(),
  1840  	)
  1841  
  1842  	return
  1843  }
  1844  
  1845  // TryOffReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.removeListener"
  1846  // in a try/catch block and returns (_, err, ok = false) when it went through
  1847  // the catch clause.
  1848  func TryOffReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1849  	ok = js.True == bindings.TryOffReceiveError(
  1850  		js.Pointer(&ret), js.Pointer(&exception),
  1851  		callback.Ref(),
  1852  	)
  1853  
  1854  	return
  1855  }
  1856  
  1857  // HasFuncHasOnReceiveError returns true if the function "WEBEXT.sockets.udp.onReceiveError.hasListener" exists.
  1858  func HasFuncHasOnReceiveError() bool {
  1859  	return js.True == bindings.HasFuncHasOnReceiveError()
  1860  }
  1861  
  1862  // FuncHasOnReceiveError returns the function "WEBEXT.sockets.udp.onReceiveError.hasListener".
  1863  func FuncHasOnReceiveError() (fn js.Func[func(callback js.Func[func(info *ReceiveErrorInfo)]) bool]) {
  1864  	bindings.FuncHasOnReceiveError(
  1865  		js.Pointer(&fn),
  1866  	)
  1867  	return
  1868  }
  1869  
  1870  // HasOnReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.hasListener" directly.
  1871  func HasOnReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret bool) {
  1872  	bindings.CallHasOnReceiveError(
  1873  		js.Pointer(&ret),
  1874  		callback.Ref(),
  1875  	)
  1876  
  1877  	return
  1878  }
  1879  
  1880  // TryHasOnReceiveError calls the function "WEBEXT.sockets.udp.onReceiveError.hasListener"
  1881  // in a try/catch block and returns (_, err, ok = false) when it went through
  1882  // the catch clause.
  1883  func TryHasOnReceiveError(callback js.Func[func(info *ReceiveErrorInfo)]) (ret bool, exception js.Any, ok bool) {
  1884  	ok = js.True == bindings.TryHasOnReceiveError(
  1885  		js.Pointer(&ret), js.Pointer(&exception),
  1886  		callback.Ref(),
  1887  	)
  1888  
  1889  	return
  1890  }
  1891  
  1892  // HasFuncSend returns true if the function "WEBEXT.sockets.udp.send" exists.
  1893  func HasFuncSend() bool {
  1894  	return js.True == bindings.HasFuncSend()
  1895  }
  1896  
  1897  // FuncSend returns the function "WEBEXT.sockets.udp.send".
  1898  func FuncSend() (fn js.Func[func(socketId int32, data js.ArrayBuffer, address js.String, port int32, dnsQueryType DnsQueryType, callback js.Func[func(sendInfo *SendInfo)])]) {
  1899  	bindings.FuncSend(
  1900  		js.Pointer(&fn),
  1901  	)
  1902  	return
  1903  }
  1904  
  1905  // Send calls the function "WEBEXT.sockets.udp.send" directly.
  1906  func Send(socketId int32, data js.ArrayBuffer, address js.String, port int32, dnsQueryType DnsQueryType, callback js.Func[func(sendInfo *SendInfo)]) (ret js.Void) {
  1907  	bindings.CallSend(
  1908  		js.Pointer(&ret),
  1909  		int32(socketId),
  1910  		data.Ref(),
  1911  		address.Ref(),
  1912  		int32(port),
  1913  		uint32(dnsQueryType),
  1914  		callback.Ref(),
  1915  	)
  1916  
  1917  	return
  1918  }
  1919  
  1920  // TrySend calls the function "WEBEXT.sockets.udp.send"
  1921  // in a try/catch block and returns (_, err, ok = false) when it went through
  1922  // the catch clause.
  1923  func TrySend(socketId int32, data js.ArrayBuffer, address js.String, port int32, dnsQueryType DnsQueryType, callback js.Func[func(sendInfo *SendInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1924  	ok = js.True == bindings.TrySend(
  1925  		js.Pointer(&ret), js.Pointer(&exception),
  1926  		int32(socketId),
  1927  		data.Ref(),
  1928  		address.Ref(),
  1929  		int32(port),
  1930  		uint32(dnsQueryType),
  1931  		callback.Ref(),
  1932  	)
  1933  
  1934  	return
  1935  }
  1936  
  1937  // HasFuncSetBroadcast returns true if the function "WEBEXT.sockets.udp.setBroadcast" exists.
  1938  func HasFuncSetBroadcast() bool {
  1939  	return js.True == bindings.HasFuncSetBroadcast()
  1940  }
  1941  
  1942  // FuncSetBroadcast returns the function "WEBEXT.sockets.udp.setBroadcast".
  1943  func FuncSetBroadcast() (fn js.Func[func(socketId int32, enabled bool, callback js.Func[func(result int32)])]) {
  1944  	bindings.FuncSetBroadcast(
  1945  		js.Pointer(&fn),
  1946  	)
  1947  	return
  1948  }
  1949  
  1950  // SetBroadcast calls the function "WEBEXT.sockets.udp.setBroadcast" directly.
  1951  func SetBroadcast(socketId int32, enabled bool, callback js.Func[func(result int32)]) (ret js.Void) {
  1952  	bindings.CallSetBroadcast(
  1953  		js.Pointer(&ret),
  1954  		int32(socketId),
  1955  		js.Bool(bool(enabled)),
  1956  		callback.Ref(),
  1957  	)
  1958  
  1959  	return
  1960  }
  1961  
  1962  // TrySetBroadcast calls the function "WEBEXT.sockets.udp.setBroadcast"
  1963  // in a try/catch block and returns (_, err, ok = false) when it went through
  1964  // the catch clause.
  1965  func TrySetBroadcast(socketId int32, enabled bool, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  1966  	ok = js.True == bindings.TrySetBroadcast(
  1967  		js.Pointer(&ret), js.Pointer(&exception),
  1968  		int32(socketId),
  1969  		js.Bool(bool(enabled)),
  1970  		callback.Ref(),
  1971  	)
  1972  
  1973  	return
  1974  }
  1975  
  1976  // HasFuncSetMulticastLoopbackMode returns true if the function "WEBEXT.sockets.udp.setMulticastLoopbackMode" exists.
  1977  func HasFuncSetMulticastLoopbackMode() bool {
  1978  	return js.True == bindings.HasFuncSetMulticastLoopbackMode()
  1979  }
  1980  
  1981  // FuncSetMulticastLoopbackMode returns the function "WEBEXT.sockets.udp.setMulticastLoopbackMode".
  1982  func FuncSetMulticastLoopbackMode() (fn js.Func[func(socketId int32, enabled bool, callback js.Func[func(result int32)])]) {
  1983  	bindings.FuncSetMulticastLoopbackMode(
  1984  		js.Pointer(&fn),
  1985  	)
  1986  	return
  1987  }
  1988  
  1989  // SetMulticastLoopbackMode calls the function "WEBEXT.sockets.udp.setMulticastLoopbackMode" directly.
  1990  func SetMulticastLoopbackMode(socketId int32, enabled bool, callback js.Func[func(result int32)]) (ret js.Void) {
  1991  	bindings.CallSetMulticastLoopbackMode(
  1992  		js.Pointer(&ret),
  1993  		int32(socketId),
  1994  		js.Bool(bool(enabled)),
  1995  		callback.Ref(),
  1996  	)
  1997  
  1998  	return
  1999  }
  2000  
  2001  // TrySetMulticastLoopbackMode calls the function "WEBEXT.sockets.udp.setMulticastLoopbackMode"
  2002  // in a try/catch block and returns (_, err, ok = false) when it went through
  2003  // the catch clause.
  2004  func TrySetMulticastLoopbackMode(socketId int32, enabled bool, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  2005  	ok = js.True == bindings.TrySetMulticastLoopbackMode(
  2006  		js.Pointer(&ret), js.Pointer(&exception),
  2007  		int32(socketId),
  2008  		js.Bool(bool(enabled)),
  2009  		callback.Ref(),
  2010  	)
  2011  
  2012  	return
  2013  }
  2014  
  2015  // HasFuncSetMulticastTimeToLive returns true if the function "WEBEXT.sockets.udp.setMulticastTimeToLive" exists.
  2016  func HasFuncSetMulticastTimeToLive() bool {
  2017  	return js.True == bindings.HasFuncSetMulticastTimeToLive()
  2018  }
  2019  
  2020  // FuncSetMulticastTimeToLive returns the function "WEBEXT.sockets.udp.setMulticastTimeToLive".
  2021  func FuncSetMulticastTimeToLive() (fn js.Func[func(socketId int32, ttl int32, callback js.Func[func(result int32)])]) {
  2022  	bindings.FuncSetMulticastTimeToLive(
  2023  		js.Pointer(&fn),
  2024  	)
  2025  	return
  2026  }
  2027  
  2028  // SetMulticastTimeToLive calls the function "WEBEXT.sockets.udp.setMulticastTimeToLive" directly.
  2029  func SetMulticastTimeToLive(socketId int32, ttl int32, callback js.Func[func(result int32)]) (ret js.Void) {
  2030  	bindings.CallSetMulticastTimeToLive(
  2031  		js.Pointer(&ret),
  2032  		int32(socketId),
  2033  		int32(ttl),
  2034  		callback.Ref(),
  2035  	)
  2036  
  2037  	return
  2038  }
  2039  
  2040  // TrySetMulticastTimeToLive calls the function "WEBEXT.sockets.udp.setMulticastTimeToLive"
  2041  // in a try/catch block and returns (_, err, ok = false) when it went through
  2042  // the catch clause.
  2043  func TrySetMulticastTimeToLive(socketId int32, ttl int32, callback js.Func[func(result int32)]) (ret js.Void, exception js.Any, ok bool) {
  2044  	ok = js.True == bindings.TrySetMulticastTimeToLive(
  2045  		js.Pointer(&ret), js.Pointer(&exception),
  2046  		int32(socketId),
  2047  		int32(ttl),
  2048  		callback.Ref(),
  2049  	)
  2050  
  2051  	return
  2052  }
  2053  
  2054  // HasFuncSetPaused returns true if the function "WEBEXT.sockets.udp.setPaused" exists.
  2055  func HasFuncSetPaused() bool {
  2056  	return js.True == bindings.HasFuncSetPaused()
  2057  }
  2058  
  2059  // FuncSetPaused returns the function "WEBEXT.sockets.udp.setPaused".
  2060  func FuncSetPaused() (fn js.Func[func(socketId int32, paused bool, callback js.Func[func()])]) {
  2061  	bindings.FuncSetPaused(
  2062  		js.Pointer(&fn),
  2063  	)
  2064  	return
  2065  }
  2066  
  2067  // SetPaused calls the function "WEBEXT.sockets.udp.setPaused" directly.
  2068  func SetPaused(socketId int32, paused bool, callback js.Func[func()]) (ret js.Void) {
  2069  	bindings.CallSetPaused(
  2070  		js.Pointer(&ret),
  2071  		int32(socketId),
  2072  		js.Bool(bool(paused)),
  2073  		callback.Ref(),
  2074  	)
  2075  
  2076  	return
  2077  }
  2078  
  2079  // TrySetPaused calls the function "WEBEXT.sockets.udp.setPaused"
  2080  // in a try/catch block and returns (_, err, ok = false) when it went through
  2081  // the catch clause.
  2082  func TrySetPaused(socketId int32, paused bool, callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
  2083  	ok = js.True == bindings.TrySetPaused(
  2084  		js.Pointer(&ret), js.Pointer(&exception),
  2085  		int32(socketId),
  2086  		js.Bool(bool(paused)),
  2087  		callback.Ref(),
  2088  	)
  2089  
  2090  	return
  2091  }
  2092  
  2093  // HasFuncUpdate returns true if the function "WEBEXT.sockets.udp.update" exists.
  2094  func HasFuncUpdate() bool {
  2095  	return js.True == bindings.HasFuncUpdate()
  2096  }
  2097  
  2098  // FuncUpdate returns the function "WEBEXT.sockets.udp.update".
  2099  func FuncUpdate() (fn js.Func[func(socketId int32, properties SocketProperties, callback js.Func[func()])]) {
  2100  	bindings.FuncUpdate(
  2101  		js.Pointer(&fn),
  2102  	)
  2103  	return
  2104  }
  2105  
  2106  // Update calls the function "WEBEXT.sockets.udp.update" directly.
  2107  func Update(socketId int32, properties SocketProperties, callback js.Func[func()]) (ret js.Void) {
  2108  	bindings.CallUpdate(
  2109  		js.Pointer(&ret),
  2110  		int32(socketId),
  2111  		js.Pointer(&properties),
  2112  		callback.Ref(),
  2113  	)
  2114  
  2115  	return
  2116  }
  2117  
  2118  // TryUpdate calls the function "WEBEXT.sockets.udp.update"
  2119  // in a try/catch block and returns (_, err, ok = false) when it went through
  2120  // the catch clause.
  2121  func TryUpdate(socketId int32, properties SocketProperties, callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
  2122  	ok = js.True == bindings.TryUpdate(
  2123  		js.Pointer(&ret), js.Pointer(&exception),
  2124  		int32(socketId),
  2125  		js.Pointer(&properties),
  2126  		callback.Ref(),
  2127  	)
  2128  
  2129  	return
  2130  }