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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package bluetoothlowenergy
     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/bluetoothlowenergy/bindings"
    11  )
    12  
    13  type AdvertisementType uint32
    14  
    15  const (
    16  	_ AdvertisementType = iota
    17  
    18  	AdvertisementType_BROADCAST
    19  	AdvertisementType_PERIPHERAL
    20  )
    21  
    22  func (AdvertisementType) FromRef(str js.Ref) AdvertisementType {
    23  	return AdvertisementType(bindings.ConstOfAdvertisementType(str))
    24  }
    25  
    26  func (x AdvertisementType) String() (string, bool) {
    27  	switch x {
    28  	case AdvertisementType_BROADCAST:
    29  		return "broadcast", true
    30  	case AdvertisementType_PERIPHERAL:
    31  		return "peripheral", true
    32  	default:
    33  		return "", false
    34  	}
    35  }
    36  
    37  type ManufacturerData struct {
    38  	// Id is "ManufacturerData.id"
    39  	//
    40  	// Optional
    41  	//
    42  	// NOTE: FFI_USE_Id MUST be set to true to make this field effective.
    43  	Id int32
    44  	// Data is "ManufacturerData.data"
    45  	//
    46  	// Optional
    47  	Data js.Array[int32]
    48  
    49  	FFI_USE_Id bool // for Id.
    50  
    51  	FFI_USE bool
    52  }
    53  
    54  // FromRef calls UpdateFrom and returns a ManufacturerData with all fields set.
    55  func (p ManufacturerData) FromRef(ref js.Ref) ManufacturerData {
    56  	p.UpdateFrom(ref)
    57  	return p
    58  }
    59  
    60  // New creates a new ManufacturerData in the application heap.
    61  func (p ManufacturerData) New() js.Ref {
    62  	return bindings.ManufacturerDataJSLoad(
    63  		js.Pointer(&p), js.True, 0,
    64  	)
    65  }
    66  
    67  // UpdateFrom copies value of all fields of the heap object to p.
    68  func (p *ManufacturerData) UpdateFrom(ref js.Ref) {
    69  	bindings.ManufacturerDataJSStore(
    70  		js.Pointer(p), ref,
    71  	)
    72  }
    73  
    74  // Update writes all fields of the p to the heap object referenced by ref.
    75  func (p *ManufacturerData) Update(ref js.Ref) {
    76  	bindings.ManufacturerDataJSLoad(
    77  		js.Pointer(p), js.False, ref,
    78  	)
    79  }
    80  
    81  // FreeMembers frees fields with heap reference, if recursive is true
    82  // free all heap references reachable from p.
    83  func (p *ManufacturerData) FreeMembers(recursive bool) {
    84  	js.Free(
    85  		p.Data.Ref(),
    86  	)
    87  	p.Data = p.Data.FromRef(js.Undefined)
    88  }
    89  
    90  type ServiceData struct {
    91  	// Uuid is "ServiceData.uuid"
    92  	//
    93  	// Optional
    94  	Uuid js.String
    95  	// Data is "ServiceData.data"
    96  	//
    97  	// Optional
    98  	Data js.Array[int32]
    99  
   100  	FFI_USE bool
   101  }
   102  
   103  // FromRef calls UpdateFrom and returns a ServiceData with all fields set.
   104  func (p ServiceData) FromRef(ref js.Ref) ServiceData {
   105  	p.UpdateFrom(ref)
   106  	return p
   107  }
   108  
   109  // New creates a new ServiceData in the application heap.
   110  func (p ServiceData) New() js.Ref {
   111  	return bindings.ServiceDataJSLoad(
   112  		js.Pointer(&p), js.True, 0,
   113  	)
   114  }
   115  
   116  // UpdateFrom copies value of all fields of the heap object to p.
   117  func (p *ServiceData) UpdateFrom(ref js.Ref) {
   118  	bindings.ServiceDataJSStore(
   119  		js.Pointer(p), ref,
   120  	)
   121  }
   122  
   123  // Update writes all fields of the p to the heap object referenced by ref.
   124  func (p *ServiceData) Update(ref js.Ref) {
   125  	bindings.ServiceDataJSLoad(
   126  		js.Pointer(p), js.False, ref,
   127  	)
   128  }
   129  
   130  // FreeMembers frees fields with heap reference, if recursive is true
   131  // free all heap references reachable from p.
   132  func (p *ServiceData) FreeMembers(recursive bool) {
   133  	js.Free(
   134  		p.Uuid.Ref(),
   135  		p.Data.Ref(),
   136  	)
   137  	p.Uuid = p.Uuid.FromRef(js.Undefined)
   138  	p.Data = p.Data.FromRef(js.Undefined)
   139  }
   140  
   141  type Advertisement struct {
   142  	// Type is "Advertisement.type"
   143  	//
   144  	// Optional
   145  	Type AdvertisementType
   146  	// ServiceUuids is "Advertisement.serviceUuids"
   147  	//
   148  	// Optional
   149  	ServiceUuids js.Array[js.String]
   150  	// ManufacturerData is "Advertisement.manufacturerData"
   151  	//
   152  	// Optional
   153  	ManufacturerData js.Array[ManufacturerData]
   154  	// SolicitUuids is "Advertisement.solicitUuids"
   155  	//
   156  	// Optional
   157  	SolicitUuids js.Array[js.String]
   158  	// ServiceData is "Advertisement.serviceData"
   159  	//
   160  	// Optional
   161  	ServiceData js.Array[ServiceData]
   162  
   163  	FFI_USE bool
   164  }
   165  
   166  // FromRef calls UpdateFrom and returns a Advertisement with all fields set.
   167  func (p Advertisement) FromRef(ref js.Ref) Advertisement {
   168  	p.UpdateFrom(ref)
   169  	return p
   170  }
   171  
   172  // New creates a new Advertisement in the application heap.
   173  func (p Advertisement) New() js.Ref {
   174  	return bindings.AdvertisementJSLoad(
   175  		js.Pointer(&p), js.True, 0,
   176  	)
   177  }
   178  
   179  // UpdateFrom copies value of all fields of the heap object to p.
   180  func (p *Advertisement) UpdateFrom(ref js.Ref) {
   181  	bindings.AdvertisementJSStore(
   182  		js.Pointer(p), ref,
   183  	)
   184  }
   185  
   186  // Update writes all fields of the p to the heap object referenced by ref.
   187  func (p *Advertisement) Update(ref js.Ref) {
   188  	bindings.AdvertisementJSLoad(
   189  		js.Pointer(p), js.False, ref,
   190  	)
   191  }
   192  
   193  // FreeMembers frees fields with heap reference, if recursive is true
   194  // free all heap references reachable from p.
   195  func (p *Advertisement) FreeMembers(recursive bool) {
   196  	js.Free(
   197  		p.ServiceUuids.Ref(),
   198  		p.ManufacturerData.Ref(),
   199  		p.SolicitUuids.Ref(),
   200  		p.ServiceData.Ref(),
   201  	)
   202  	p.ServiceUuids = p.ServiceUuids.FromRef(js.Undefined)
   203  	p.ManufacturerData = p.ManufacturerData.FromRef(js.Undefined)
   204  	p.SolicitUuids = p.SolicitUuids.FromRef(js.Undefined)
   205  	p.ServiceData = p.ServiceData.FromRef(js.Undefined)
   206  }
   207  
   208  type Service struct {
   209  	// Uuid is "Service.uuid"
   210  	//
   211  	// Optional
   212  	Uuid js.String
   213  	// IsPrimary is "Service.isPrimary"
   214  	//
   215  	// Optional
   216  	//
   217  	// NOTE: FFI_USE_IsPrimary MUST be set to true to make this field effective.
   218  	IsPrimary bool
   219  	// InstanceId is "Service.instanceId"
   220  	//
   221  	// Optional
   222  	InstanceId js.String
   223  	// DeviceAddress is "Service.deviceAddress"
   224  	//
   225  	// Optional
   226  	DeviceAddress js.String
   227  
   228  	FFI_USE_IsPrimary bool // for IsPrimary.
   229  
   230  	FFI_USE bool
   231  }
   232  
   233  // FromRef calls UpdateFrom and returns a Service with all fields set.
   234  func (p Service) FromRef(ref js.Ref) Service {
   235  	p.UpdateFrom(ref)
   236  	return p
   237  }
   238  
   239  // New creates a new Service in the application heap.
   240  func (p Service) New() js.Ref {
   241  	return bindings.ServiceJSLoad(
   242  		js.Pointer(&p), js.True, 0,
   243  	)
   244  }
   245  
   246  // UpdateFrom copies value of all fields of the heap object to p.
   247  func (p *Service) UpdateFrom(ref js.Ref) {
   248  	bindings.ServiceJSStore(
   249  		js.Pointer(p), ref,
   250  	)
   251  }
   252  
   253  // Update writes all fields of the p to the heap object referenced by ref.
   254  func (p *Service) Update(ref js.Ref) {
   255  	bindings.ServiceJSLoad(
   256  		js.Pointer(p), js.False, ref,
   257  	)
   258  }
   259  
   260  // FreeMembers frees fields with heap reference, if recursive is true
   261  // free all heap references reachable from p.
   262  func (p *Service) FreeMembers(recursive bool) {
   263  	js.Free(
   264  		p.Uuid.Ref(),
   265  		p.InstanceId.Ref(),
   266  		p.DeviceAddress.Ref(),
   267  	)
   268  	p.Uuid = p.Uuid.FromRef(js.Undefined)
   269  	p.InstanceId = p.InstanceId.FromRef(js.Undefined)
   270  	p.DeviceAddress = p.DeviceAddress.FromRef(js.Undefined)
   271  }
   272  
   273  type CharacteristicProperty uint32
   274  
   275  const (
   276  	_ CharacteristicProperty = iota
   277  
   278  	CharacteristicProperty_BROADCAST
   279  	CharacteristicProperty_READ
   280  	CharacteristicProperty_WRITE_WITHOUT_RESPONSE
   281  	CharacteristicProperty_WRITE
   282  	CharacteristicProperty_NOTIFY
   283  	CharacteristicProperty_INDICATE
   284  	CharacteristicProperty_AUTHENTICATED_SIGNED_WRITES
   285  	CharacteristicProperty_EXTENDED_PROPERTIES
   286  	CharacteristicProperty_RELIABLE_WRITE
   287  	CharacteristicProperty_WRITABLE_AUXILIARIES
   288  	CharacteristicProperty_ENCRYPT_READ
   289  	CharacteristicProperty_ENCRYPT_WRITE
   290  	CharacteristicProperty_ENCRYPT_AUTHENTICATED_READ
   291  	CharacteristicProperty_ENCRYPT_AUTHENTICATED_WRITE
   292  )
   293  
   294  func (CharacteristicProperty) FromRef(str js.Ref) CharacteristicProperty {
   295  	return CharacteristicProperty(bindings.ConstOfCharacteristicProperty(str))
   296  }
   297  
   298  func (x CharacteristicProperty) String() (string, bool) {
   299  	switch x {
   300  	case CharacteristicProperty_BROADCAST:
   301  		return "broadcast", true
   302  	case CharacteristicProperty_READ:
   303  		return "read", true
   304  	case CharacteristicProperty_WRITE_WITHOUT_RESPONSE:
   305  		return "writeWithoutResponse", true
   306  	case CharacteristicProperty_WRITE:
   307  		return "write", true
   308  	case CharacteristicProperty_NOTIFY:
   309  		return "notify", true
   310  	case CharacteristicProperty_INDICATE:
   311  		return "indicate", true
   312  	case CharacteristicProperty_AUTHENTICATED_SIGNED_WRITES:
   313  		return "authenticatedSignedWrites", true
   314  	case CharacteristicProperty_EXTENDED_PROPERTIES:
   315  		return "extendedProperties", true
   316  	case CharacteristicProperty_RELIABLE_WRITE:
   317  		return "reliableWrite", true
   318  	case CharacteristicProperty_WRITABLE_AUXILIARIES:
   319  		return "writableAuxiliaries", true
   320  	case CharacteristicProperty_ENCRYPT_READ:
   321  		return "encryptRead", true
   322  	case CharacteristicProperty_ENCRYPT_WRITE:
   323  		return "encryptWrite", true
   324  	case CharacteristicProperty_ENCRYPT_AUTHENTICATED_READ:
   325  		return "encryptAuthenticatedRead", true
   326  	case CharacteristicProperty_ENCRYPT_AUTHENTICATED_WRITE:
   327  		return "encryptAuthenticatedWrite", true
   328  	default:
   329  		return "", false
   330  	}
   331  }
   332  
   333  type Characteristic struct {
   334  	// Uuid is "Characteristic.uuid"
   335  	//
   336  	// Optional
   337  	Uuid js.String
   338  	// Service is "Characteristic.service"
   339  	//
   340  	// Optional
   341  	//
   342  	// NOTE: Service.FFI_USE MUST be set to true to get Service used.
   343  	Service Service
   344  	// Properties is "Characteristic.properties"
   345  	//
   346  	// Optional
   347  	Properties js.Array[CharacteristicProperty]
   348  	// InstanceId is "Characteristic.instanceId"
   349  	//
   350  	// Optional
   351  	InstanceId js.String
   352  	// Value is "Characteristic.value"
   353  	//
   354  	// Optional
   355  	Value js.ArrayBuffer
   356  
   357  	FFI_USE bool
   358  }
   359  
   360  // FromRef calls UpdateFrom and returns a Characteristic with all fields set.
   361  func (p Characteristic) FromRef(ref js.Ref) Characteristic {
   362  	p.UpdateFrom(ref)
   363  	return p
   364  }
   365  
   366  // New creates a new Characteristic in the application heap.
   367  func (p Characteristic) New() js.Ref {
   368  	return bindings.CharacteristicJSLoad(
   369  		js.Pointer(&p), js.True, 0,
   370  	)
   371  }
   372  
   373  // UpdateFrom copies value of all fields of the heap object to p.
   374  func (p *Characteristic) UpdateFrom(ref js.Ref) {
   375  	bindings.CharacteristicJSStore(
   376  		js.Pointer(p), ref,
   377  	)
   378  }
   379  
   380  // Update writes all fields of the p to the heap object referenced by ref.
   381  func (p *Characteristic) Update(ref js.Ref) {
   382  	bindings.CharacteristicJSLoad(
   383  		js.Pointer(p), js.False, ref,
   384  	)
   385  }
   386  
   387  // FreeMembers frees fields with heap reference, if recursive is true
   388  // free all heap references reachable from p.
   389  func (p *Characteristic) FreeMembers(recursive bool) {
   390  	js.Free(
   391  		p.Uuid.Ref(),
   392  		p.Properties.Ref(),
   393  		p.InstanceId.Ref(),
   394  		p.Value.Ref(),
   395  	)
   396  	p.Uuid = p.Uuid.FromRef(js.Undefined)
   397  	p.Properties = p.Properties.FromRef(js.Undefined)
   398  	p.InstanceId = p.InstanceId.FromRef(js.Undefined)
   399  	p.Value = p.Value.FromRef(js.Undefined)
   400  	if recursive {
   401  		p.Service.FreeMembers(true)
   402  	}
   403  }
   404  
   405  type CharacteristicCallbackFunc func(this js.Ref, result *Characteristic) js.Ref
   406  
   407  func (fn CharacteristicCallbackFunc) Register() js.Func[func(result *Characteristic)] {
   408  	return js.RegisterCallback[func(result *Characteristic)](
   409  		fn, abi.FuncPCABIInternal(fn),
   410  	)
   411  }
   412  
   413  func (fn CharacteristicCallbackFunc) DispatchCallback(
   414  	targetPC uintptr, ctx *js.CallbackContext,
   415  ) {
   416  	args := ctx.Args()
   417  	if len(args) != 1+1 /* js this */ ||
   418  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   419  		js.ThrowInvalidCallbackInvocation()
   420  	}
   421  	var arg0 Characteristic
   422  	arg0.UpdateFrom(args[0+1])
   423  	defer arg0.FreeMembers(true)
   424  
   425  	if ctx.Return(fn(
   426  		args[0],
   427  
   428  		mark.NoEscape(&arg0),
   429  	)) {
   430  		return
   431  	}
   432  
   433  	js.ThrowCallbackValueNotReturned()
   434  }
   435  
   436  type CharacteristicCallback[T any] struct {
   437  	Fn  func(arg T, this js.Ref, result *Characteristic) js.Ref
   438  	Arg T
   439  }
   440  
   441  func (cb *CharacteristicCallback[T]) Register() js.Func[func(result *Characteristic)] {
   442  	return js.RegisterCallback[func(result *Characteristic)](
   443  		cb, abi.FuncPCABIInternal(cb.Fn),
   444  	)
   445  }
   446  
   447  func (cb *CharacteristicCallback[T]) DispatchCallback(
   448  	targetPC uintptr, ctx *js.CallbackContext,
   449  ) {
   450  	args := ctx.Args()
   451  	if len(args) != 1+1 /* js this */ ||
   452  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   453  		js.ThrowInvalidCallbackInvocation()
   454  	}
   455  	var arg0 Characteristic
   456  	arg0.UpdateFrom(args[0+1])
   457  	defer arg0.FreeMembers(true)
   458  
   459  	if ctx.Return(cb.Fn(
   460  		cb.Arg,
   461  		args[0],
   462  
   463  		mark.NoEscape(&arg0),
   464  	)) {
   465  		return
   466  	}
   467  
   468  	js.ThrowCallbackValueNotReturned()
   469  }
   470  
   471  type CharacteristicsCallbackFunc func(this js.Ref, result js.Array[Characteristic]) js.Ref
   472  
   473  func (fn CharacteristicsCallbackFunc) Register() js.Func[func(result js.Array[Characteristic])] {
   474  	return js.RegisterCallback[func(result js.Array[Characteristic])](
   475  		fn, abi.FuncPCABIInternal(fn),
   476  	)
   477  }
   478  
   479  func (fn CharacteristicsCallbackFunc) DispatchCallback(
   480  	targetPC uintptr, ctx *js.CallbackContext,
   481  ) {
   482  	args := ctx.Args()
   483  	if len(args) != 1+1 /* js this */ ||
   484  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   485  		js.ThrowInvalidCallbackInvocation()
   486  	}
   487  
   488  	if ctx.Return(fn(
   489  		args[0],
   490  
   491  		js.Array[Characteristic]{}.FromRef(args[0+1]),
   492  	)) {
   493  		return
   494  	}
   495  
   496  	js.ThrowCallbackValueNotReturned()
   497  }
   498  
   499  type CharacteristicsCallback[T any] struct {
   500  	Fn  func(arg T, this js.Ref, result js.Array[Characteristic]) js.Ref
   501  	Arg T
   502  }
   503  
   504  func (cb *CharacteristicsCallback[T]) Register() js.Func[func(result js.Array[Characteristic])] {
   505  	return js.RegisterCallback[func(result js.Array[Characteristic])](
   506  		cb, abi.FuncPCABIInternal(cb.Fn),
   507  	)
   508  }
   509  
   510  func (cb *CharacteristicsCallback[T]) DispatchCallback(
   511  	targetPC uintptr, ctx *js.CallbackContext,
   512  ) {
   513  	args := ctx.Args()
   514  	if len(args) != 1+1 /* js this */ ||
   515  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   516  		js.ThrowInvalidCallbackInvocation()
   517  	}
   518  
   519  	if ctx.Return(cb.Fn(
   520  		cb.Arg,
   521  		args[0],
   522  
   523  		js.Array[Characteristic]{}.FromRef(args[0+1]),
   524  	)) {
   525  		return
   526  	}
   527  
   528  	js.ThrowCallbackValueNotReturned()
   529  }
   530  
   531  type ConnectProperties struct {
   532  	// Persistent is "ConnectProperties.persistent"
   533  	//
   534  	// Optional
   535  	//
   536  	// NOTE: FFI_USE_Persistent MUST be set to true to make this field effective.
   537  	Persistent bool
   538  
   539  	FFI_USE_Persistent bool // for Persistent.
   540  
   541  	FFI_USE bool
   542  }
   543  
   544  // FromRef calls UpdateFrom and returns a ConnectProperties with all fields set.
   545  func (p ConnectProperties) FromRef(ref js.Ref) ConnectProperties {
   546  	p.UpdateFrom(ref)
   547  	return p
   548  }
   549  
   550  // New creates a new ConnectProperties in the application heap.
   551  func (p ConnectProperties) New() js.Ref {
   552  	return bindings.ConnectPropertiesJSLoad(
   553  		js.Pointer(&p), js.True, 0,
   554  	)
   555  }
   556  
   557  // UpdateFrom copies value of all fields of the heap object to p.
   558  func (p *ConnectProperties) UpdateFrom(ref js.Ref) {
   559  	bindings.ConnectPropertiesJSStore(
   560  		js.Pointer(p), ref,
   561  	)
   562  }
   563  
   564  // Update writes all fields of the p to the heap object referenced by ref.
   565  func (p *ConnectProperties) Update(ref js.Ref) {
   566  	bindings.ConnectPropertiesJSLoad(
   567  		js.Pointer(p), js.False, ref,
   568  	)
   569  }
   570  
   571  // FreeMembers frees fields with heap reference, if recursive is true
   572  // free all heap references reachable from p.
   573  func (p *ConnectProperties) FreeMembers(recursive bool) {
   574  }
   575  
   576  type CreateCharacteristicCallbackFunc func(this js.Ref, characteristicId js.String) js.Ref
   577  
   578  func (fn CreateCharacteristicCallbackFunc) Register() js.Func[func(characteristicId js.String)] {
   579  	return js.RegisterCallback[func(characteristicId js.String)](
   580  		fn, abi.FuncPCABIInternal(fn),
   581  	)
   582  }
   583  
   584  func (fn CreateCharacteristicCallbackFunc) DispatchCallback(
   585  	targetPC uintptr, ctx *js.CallbackContext,
   586  ) {
   587  	args := ctx.Args()
   588  	if len(args) != 1+1 /* js this */ ||
   589  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   590  		js.ThrowInvalidCallbackInvocation()
   591  	}
   592  
   593  	if ctx.Return(fn(
   594  		args[0],
   595  
   596  		js.String{}.FromRef(args[0+1]),
   597  	)) {
   598  		return
   599  	}
   600  
   601  	js.ThrowCallbackValueNotReturned()
   602  }
   603  
   604  type CreateCharacteristicCallback[T any] struct {
   605  	Fn  func(arg T, this js.Ref, characteristicId js.String) js.Ref
   606  	Arg T
   607  }
   608  
   609  func (cb *CreateCharacteristicCallback[T]) Register() js.Func[func(characteristicId js.String)] {
   610  	return js.RegisterCallback[func(characteristicId js.String)](
   611  		cb, abi.FuncPCABIInternal(cb.Fn),
   612  	)
   613  }
   614  
   615  func (cb *CreateCharacteristicCallback[T]) DispatchCallback(
   616  	targetPC uintptr, ctx *js.CallbackContext,
   617  ) {
   618  	args := ctx.Args()
   619  	if len(args) != 1+1 /* js this */ ||
   620  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   621  		js.ThrowInvalidCallbackInvocation()
   622  	}
   623  
   624  	if ctx.Return(cb.Fn(
   625  		cb.Arg,
   626  		args[0],
   627  
   628  		js.String{}.FromRef(args[0+1]),
   629  	)) {
   630  		return
   631  	}
   632  
   633  	js.ThrowCallbackValueNotReturned()
   634  }
   635  
   636  type CreateDescriptorCallbackFunc func(this js.Ref, descriptorId js.String) js.Ref
   637  
   638  func (fn CreateDescriptorCallbackFunc) Register() js.Func[func(descriptorId js.String)] {
   639  	return js.RegisterCallback[func(descriptorId js.String)](
   640  		fn, abi.FuncPCABIInternal(fn),
   641  	)
   642  }
   643  
   644  func (fn CreateDescriptorCallbackFunc) DispatchCallback(
   645  	targetPC uintptr, ctx *js.CallbackContext,
   646  ) {
   647  	args := ctx.Args()
   648  	if len(args) != 1+1 /* js this */ ||
   649  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   650  		js.ThrowInvalidCallbackInvocation()
   651  	}
   652  
   653  	if ctx.Return(fn(
   654  		args[0],
   655  
   656  		js.String{}.FromRef(args[0+1]),
   657  	)) {
   658  		return
   659  	}
   660  
   661  	js.ThrowCallbackValueNotReturned()
   662  }
   663  
   664  type CreateDescriptorCallback[T any] struct {
   665  	Fn  func(arg T, this js.Ref, descriptorId js.String) js.Ref
   666  	Arg T
   667  }
   668  
   669  func (cb *CreateDescriptorCallback[T]) Register() js.Func[func(descriptorId js.String)] {
   670  	return js.RegisterCallback[func(descriptorId js.String)](
   671  		cb, abi.FuncPCABIInternal(cb.Fn),
   672  	)
   673  }
   674  
   675  func (cb *CreateDescriptorCallback[T]) DispatchCallback(
   676  	targetPC uintptr, ctx *js.CallbackContext,
   677  ) {
   678  	args := ctx.Args()
   679  	if len(args) != 1+1 /* js this */ ||
   680  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   681  		js.ThrowInvalidCallbackInvocation()
   682  	}
   683  
   684  	if ctx.Return(cb.Fn(
   685  		cb.Arg,
   686  		args[0],
   687  
   688  		js.String{}.FromRef(args[0+1]),
   689  	)) {
   690  		return
   691  	}
   692  
   693  	js.ThrowCallbackValueNotReturned()
   694  }
   695  
   696  type CreateServiceCallbackFunc func(this js.Ref, serviceId js.String) js.Ref
   697  
   698  func (fn CreateServiceCallbackFunc) Register() js.Func[func(serviceId js.String)] {
   699  	return js.RegisterCallback[func(serviceId js.String)](
   700  		fn, abi.FuncPCABIInternal(fn),
   701  	)
   702  }
   703  
   704  func (fn CreateServiceCallbackFunc) DispatchCallback(
   705  	targetPC uintptr, ctx *js.CallbackContext,
   706  ) {
   707  	args := ctx.Args()
   708  	if len(args) != 1+1 /* js this */ ||
   709  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   710  		js.ThrowInvalidCallbackInvocation()
   711  	}
   712  
   713  	if ctx.Return(fn(
   714  		args[0],
   715  
   716  		js.String{}.FromRef(args[0+1]),
   717  	)) {
   718  		return
   719  	}
   720  
   721  	js.ThrowCallbackValueNotReturned()
   722  }
   723  
   724  type CreateServiceCallback[T any] struct {
   725  	Fn  func(arg T, this js.Ref, serviceId js.String) js.Ref
   726  	Arg T
   727  }
   728  
   729  func (cb *CreateServiceCallback[T]) Register() js.Func[func(serviceId js.String)] {
   730  	return js.RegisterCallback[func(serviceId js.String)](
   731  		cb, abi.FuncPCABIInternal(cb.Fn),
   732  	)
   733  }
   734  
   735  func (cb *CreateServiceCallback[T]) DispatchCallback(
   736  	targetPC uintptr, ctx *js.CallbackContext,
   737  ) {
   738  	args := ctx.Args()
   739  	if len(args) != 1+1 /* js this */ ||
   740  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   741  		js.ThrowInvalidCallbackInvocation()
   742  	}
   743  
   744  	if ctx.Return(cb.Fn(
   745  		cb.Arg,
   746  		args[0],
   747  
   748  		js.String{}.FromRef(args[0+1]),
   749  	)) {
   750  		return
   751  	}
   752  
   753  	js.ThrowCallbackValueNotReturned()
   754  }
   755  
   756  type DescriptorPermission uint32
   757  
   758  const (
   759  	_ DescriptorPermission = iota
   760  
   761  	DescriptorPermission_READ
   762  	DescriptorPermission_WRITE
   763  	DescriptorPermission_ENCRYPTED_READ
   764  	DescriptorPermission_ENCRYPTED_WRITE
   765  	DescriptorPermission_ENCRYPTED_AUTHENTICATED_READ
   766  	DescriptorPermission_ENCRYPTED_AUTHENTICATED_WRITE
   767  )
   768  
   769  func (DescriptorPermission) FromRef(str js.Ref) DescriptorPermission {
   770  	return DescriptorPermission(bindings.ConstOfDescriptorPermission(str))
   771  }
   772  
   773  func (x DescriptorPermission) String() (string, bool) {
   774  	switch x {
   775  	case DescriptorPermission_READ:
   776  		return "read", true
   777  	case DescriptorPermission_WRITE:
   778  		return "write", true
   779  	case DescriptorPermission_ENCRYPTED_READ:
   780  		return "encryptedRead", true
   781  	case DescriptorPermission_ENCRYPTED_WRITE:
   782  		return "encryptedWrite", true
   783  	case DescriptorPermission_ENCRYPTED_AUTHENTICATED_READ:
   784  		return "encryptedAuthenticatedRead", true
   785  	case DescriptorPermission_ENCRYPTED_AUTHENTICATED_WRITE:
   786  		return "encryptedAuthenticatedWrite", true
   787  	default:
   788  		return "", false
   789  	}
   790  }
   791  
   792  type Descriptor struct {
   793  	// Uuid is "Descriptor.uuid"
   794  	//
   795  	// Optional
   796  	Uuid js.String
   797  	// Characteristic is "Descriptor.characteristic"
   798  	//
   799  	// Optional
   800  	//
   801  	// NOTE: Characteristic.FFI_USE MUST be set to true to get Characteristic used.
   802  	Characteristic Characteristic
   803  	// Permissions is "Descriptor.permissions"
   804  	//
   805  	// Optional
   806  	Permissions js.Array[DescriptorPermission]
   807  	// InstanceId is "Descriptor.instanceId"
   808  	//
   809  	// Optional
   810  	InstanceId js.String
   811  	// Value is "Descriptor.value"
   812  	//
   813  	// Optional
   814  	Value js.ArrayBuffer
   815  
   816  	FFI_USE bool
   817  }
   818  
   819  // FromRef calls UpdateFrom and returns a Descriptor with all fields set.
   820  func (p Descriptor) FromRef(ref js.Ref) Descriptor {
   821  	p.UpdateFrom(ref)
   822  	return p
   823  }
   824  
   825  // New creates a new Descriptor in the application heap.
   826  func (p Descriptor) New() js.Ref {
   827  	return bindings.DescriptorJSLoad(
   828  		js.Pointer(&p), js.True, 0,
   829  	)
   830  }
   831  
   832  // UpdateFrom copies value of all fields of the heap object to p.
   833  func (p *Descriptor) UpdateFrom(ref js.Ref) {
   834  	bindings.DescriptorJSStore(
   835  		js.Pointer(p), ref,
   836  	)
   837  }
   838  
   839  // Update writes all fields of the p to the heap object referenced by ref.
   840  func (p *Descriptor) Update(ref js.Ref) {
   841  	bindings.DescriptorJSLoad(
   842  		js.Pointer(p), js.False, ref,
   843  	)
   844  }
   845  
   846  // FreeMembers frees fields with heap reference, if recursive is true
   847  // free all heap references reachable from p.
   848  func (p *Descriptor) FreeMembers(recursive bool) {
   849  	js.Free(
   850  		p.Uuid.Ref(),
   851  		p.Permissions.Ref(),
   852  		p.InstanceId.Ref(),
   853  		p.Value.Ref(),
   854  	)
   855  	p.Uuid = p.Uuid.FromRef(js.Undefined)
   856  	p.Permissions = p.Permissions.FromRef(js.Undefined)
   857  	p.InstanceId = p.InstanceId.FromRef(js.Undefined)
   858  	p.Value = p.Value.FromRef(js.Undefined)
   859  	if recursive {
   860  		p.Characteristic.FreeMembers(true)
   861  	}
   862  }
   863  
   864  type DescriptorCallbackFunc func(this js.Ref, result *Descriptor) js.Ref
   865  
   866  func (fn DescriptorCallbackFunc) Register() js.Func[func(result *Descriptor)] {
   867  	return js.RegisterCallback[func(result *Descriptor)](
   868  		fn, abi.FuncPCABIInternal(fn),
   869  	)
   870  }
   871  
   872  func (fn DescriptorCallbackFunc) DispatchCallback(
   873  	targetPC uintptr, ctx *js.CallbackContext,
   874  ) {
   875  	args := ctx.Args()
   876  	if len(args) != 1+1 /* js this */ ||
   877  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   878  		js.ThrowInvalidCallbackInvocation()
   879  	}
   880  	var arg0 Descriptor
   881  	arg0.UpdateFrom(args[0+1])
   882  	defer arg0.FreeMembers(true)
   883  
   884  	if ctx.Return(fn(
   885  		args[0],
   886  
   887  		mark.NoEscape(&arg0),
   888  	)) {
   889  		return
   890  	}
   891  
   892  	js.ThrowCallbackValueNotReturned()
   893  }
   894  
   895  type DescriptorCallback[T any] struct {
   896  	Fn  func(arg T, this js.Ref, result *Descriptor) js.Ref
   897  	Arg T
   898  }
   899  
   900  func (cb *DescriptorCallback[T]) Register() js.Func[func(result *Descriptor)] {
   901  	return js.RegisterCallback[func(result *Descriptor)](
   902  		cb, abi.FuncPCABIInternal(cb.Fn),
   903  	)
   904  }
   905  
   906  func (cb *DescriptorCallback[T]) DispatchCallback(
   907  	targetPC uintptr, ctx *js.CallbackContext,
   908  ) {
   909  	args := ctx.Args()
   910  	if len(args) != 1+1 /* js this */ ||
   911  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   912  		js.ThrowInvalidCallbackInvocation()
   913  	}
   914  	var arg0 Descriptor
   915  	arg0.UpdateFrom(args[0+1])
   916  	defer arg0.FreeMembers(true)
   917  
   918  	if ctx.Return(cb.Fn(
   919  		cb.Arg,
   920  		args[0],
   921  
   922  		mark.NoEscape(&arg0),
   923  	)) {
   924  		return
   925  	}
   926  
   927  	js.ThrowCallbackValueNotReturned()
   928  }
   929  
   930  type DescriptorsCallbackFunc func(this js.Ref, result js.Array[Descriptor]) js.Ref
   931  
   932  func (fn DescriptorsCallbackFunc) Register() js.Func[func(result js.Array[Descriptor])] {
   933  	return js.RegisterCallback[func(result js.Array[Descriptor])](
   934  		fn, abi.FuncPCABIInternal(fn),
   935  	)
   936  }
   937  
   938  func (fn DescriptorsCallbackFunc) DispatchCallback(
   939  	targetPC uintptr, ctx *js.CallbackContext,
   940  ) {
   941  	args := ctx.Args()
   942  	if len(args) != 1+1 /* js this */ ||
   943  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   944  		js.ThrowInvalidCallbackInvocation()
   945  	}
   946  
   947  	if ctx.Return(fn(
   948  		args[0],
   949  
   950  		js.Array[Descriptor]{}.FromRef(args[0+1]),
   951  	)) {
   952  		return
   953  	}
   954  
   955  	js.ThrowCallbackValueNotReturned()
   956  }
   957  
   958  type DescriptorsCallback[T any] struct {
   959  	Fn  func(arg T, this js.Ref, result js.Array[Descriptor]) js.Ref
   960  	Arg T
   961  }
   962  
   963  func (cb *DescriptorsCallback[T]) Register() js.Func[func(result js.Array[Descriptor])] {
   964  	return js.RegisterCallback[func(result js.Array[Descriptor])](
   965  		cb, abi.FuncPCABIInternal(cb.Fn),
   966  	)
   967  }
   968  
   969  func (cb *DescriptorsCallback[T]) DispatchCallback(
   970  	targetPC uintptr, ctx *js.CallbackContext,
   971  ) {
   972  	args := ctx.Args()
   973  	if len(args) != 1+1 /* js this */ ||
   974  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   975  		js.ThrowInvalidCallbackInvocation()
   976  	}
   977  
   978  	if ctx.Return(cb.Fn(
   979  		cb.Arg,
   980  		args[0],
   981  
   982  		js.Array[Descriptor]{}.FromRef(args[0+1]),
   983  	)) {
   984  		return
   985  	}
   986  
   987  	js.ThrowCallbackValueNotReturned()
   988  }
   989  
   990  type Device struct {
   991  	// Address is "Device.address"
   992  	//
   993  	// Optional
   994  	Address js.String
   995  	// Name is "Device.name"
   996  	//
   997  	// Optional
   998  	Name js.String
   999  	// DeviceClass is "Device.deviceClass"
  1000  	//
  1001  	// Optional
  1002  	//
  1003  	// NOTE: FFI_USE_DeviceClass MUST be set to true to make this field effective.
  1004  	DeviceClass int32
  1005  
  1006  	FFI_USE_DeviceClass bool // for DeviceClass.
  1007  
  1008  	FFI_USE bool
  1009  }
  1010  
  1011  // FromRef calls UpdateFrom and returns a Device with all fields set.
  1012  func (p Device) FromRef(ref js.Ref) Device {
  1013  	p.UpdateFrom(ref)
  1014  	return p
  1015  }
  1016  
  1017  // New creates a new Device in the application heap.
  1018  func (p Device) New() js.Ref {
  1019  	return bindings.DeviceJSLoad(
  1020  		js.Pointer(&p), js.True, 0,
  1021  	)
  1022  }
  1023  
  1024  // UpdateFrom copies value of all fields of the heap object to p.
  1025  func (p *Device) UpdateFrom(ref js.Ref) {
  1026  	bindings.DeviceJSStore(
  1027  		js.Pointer(p), ref,
  1028  	)
  1029  }
  1030  
  1031  // Update writes all fields of the p to the heap object referenced by ref.
  1032  func (p *Device) Update(ref js.Ref) {
  1033  	bindings.DeviceJSLoad(
  1034  		js.Pointer(p), js.False, ref,
  1035  	)
  1036  }
  1037  
  1038  // FreeMembers frees fields with heap reference, if recursive is true
  1039  // free all heap references reachable from p.
  1040  func (p *Device) FreeMembers(recursive bool) {
  1041  	js.Free(
  1042  		p.Address.Ref(),
  1043  		p.Name.Ref(),
  1044  	)
  1045  	p.Address = p.Address.FromRef(js.Undefined)
  1046  	p.Name = p.Name.FromRef(js.Undefined)
  1047  }
  1048  
  1049  type Notification struct {
  1050  	// Value is "Notification.value"
  1051  	//
  1052  	// Optional
  1053  	Value js.ArrayBuffer
  1054  	// ShouldIndicate is "Notification.shouldIndicate"
  1055  	//
  1056  	// Optional
  1057  	//
  1058  	// NOTE: FFI_USE_ShouldIndicate MUST be set to true to make this field effective.
  1059  	ShouldIndicate bool
  1060  
  1061  	FFI_USE_ShouldIndicate bool // for ShouldIndicate.
  1062  
  1063  	FFI_USE bool
  1064  }
  1065  
  1066  // FromRef calls UpdateFrom and returns a Notification with all fields set.
  1067  func (p Notification) FromRef(ref js.Ref) Notification {
  1068  	p.UpdateFrom(ref)
  1069  	return p
  1070  }
  1071  
  1072  // New creates a new Notification in the application heap.
  1073  func (p Notification) New() js.Ref {
  1074  	return bindings.NotificationJSLoad(
  1075  		js.Pointer(&p), js.True, 0,
  1076  	)
  1077  }
  1078  
  1079  // UpdateFrom copies value of all fields of the heap object to p.
  1080  func (p *Notification) UpdateFrom(ref js.Ref) {
  1081  	bindings.NotificationJSStore(
  1082  		js.Pointer(p), ref,
  1083  	)
  1084  }
  1085  
  1086  // Update writes all fields of the p to the heap object referenced by ref.
  1087  func (p *Notification) Update(ref js.Ref) {
  1088  	bindings.NotificationJSLoad(
  1089  		js.Pointer(p), js.False, ref,
  1090  	)
  1091  }
  1092  
  1093  // FreeMembers frees fields with heap reference, if recursive is true
  1094  // free all heap references reachable from p.
  1095  func (p *Notification) FreeMembers(recursive bool) {
  1096  	js.Free(
  1097  		p.Value.Ref(),
  1098  	)
  1099  	p.Value = p.Value.FromRef(js.Undefined)
  1100  }
  1101  
  1102  type NotificationProperties struct {
  1103  	// Persistent is "NotificationProperties.persistent"
  1104  	//
  1105  	// Optional
  1106  	//
  1107  	// NOTE: FFI_USE_Persistent MUST be set to true to make this field effective.
  1108  	Persistent bool
  1109  
  1110  	FFI_USE_Persistent bool // for Persistent.
  1111  
  1112  	FFI_USE bool
  1113  }
  1114  
  1115  // FromRef calls UpdateFrom and returns a NotificationProperties with all fields set.
  1116  func (p NotificationProperties) FromRef(ref js.Ref) NotificationProperties {
  1117  	p.UpdateFrom(ref)
  1118  	return p
  1119  }
  1120  
  1121  // New creates a new NotificationProperties in the application heap.
  1122  func (p NotificationProperties) New() js.Ref {
  1123  	return bindings.NotificationPropertiesJSLoad(
  1124  		js.Pointer(&p), js.True, 0,
  1125  	)
  1126  }
  1127  
  1128  // UpdateFrom copies value of all fields of the heap object to p.
  1129  func (p *NotificationProperties) UpdateFrom(ref js.Ref) {
  1130  	bindings.NotificationPropertiesJSStore(
  1131  		js.Pointer(p), ref,
  1132  	)
  1133  }
  1134  
  1135  // Update writes all fields of the p to the heap object referenced by ref.
  1136  func (p *NotificationProperties) Update(ref js.Ref) {
  1137  	bindings.NotificationPropertiesJSLoad(
  1138  		js.Pointer(p), js.False, ref,
  1139  	)
  1140  }
  1141  
  1142  // FreeMembers frees fields with heap reference, if recursive is true
  1143  // free all heap references reachable from p.
  1144  func (p *NotificationProperties) FreeMembers(recursive bool) {
  1145  }
  1146  
  1147  type RegisterAdvertisementCallbackFunc func(this js.Ref, advertisementId int32) js.Ref
  1148  
  1149  func (fn RegisterAdvertisementCallbackFunc) Register() js.Func[func(advertisementId int32)] {
  1150  	return js.RegisterCallback[func(advertisementId int32)](
  1151  		fn, abi.FuncPCABIInternal(fn),
  1152  	)
  1153  }
  1154  
  1155  func (fn RegisterAdvertisementCallbackFunc) DispatchCallback(
  1156  	targetPC uintptr, ctx *js.CallbackContext,
  1157  ) {
  1158  	args := ctx.Args()
  1159  	if len(args) != 1+1 /* js this */ ||
  1160  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1161  		js.ThrowInvalidCallbackInvocation()
  1162  	}
  1163  
  1164  	if ctx.Return(fn(
  1165  		args[0],
  1166  
  1167  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  1168  	)) {
  1169  		return
  1170  	}
  1171  
  1172  	js.ThrowCallbackValueNotReturned()
  1173  }
  1174  
  1175  type RegisterAdvertisementCallback[T any] struct {
  1176  	Fn  func(arg T, this js.Ref, advertisementId int32) js.Ref
  1177  	Arg T
  1178  }
  1179  
  1180  func (cb *RegisterAdvertisementCallback[T]) Register() js.Func[func(advertisementId int32)] {
  1181  	return js.RegisterCallback[func(advertisementId int32)](
  1182  		cb, abi.FuncPCABIInternal(cb.Fn),
  1183  	)
  1184  }
  1185  
  1186  func (cb *RegisterAdvertisementCallback[T]) DispatchCallback(
  1187  	targetPC uintptr, ctx *js.CallbackContext,
  1188  ) {
  1189  	args := ctx.Args()
  1190  	if len(args) != 1+1 /* js this */ ||
  1191  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1192  		js.ThrowInvalidCallbackInvocation()
  1193  	}
  1194  
  1195  	if ctx.Return(cb.Fn(
  1196  		cb.Arg,
  1197  		args[0],
  1198  
  1199  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  1200  	)) {
  1201  		return
  1202  	}
  1203  
  1204  	js.ThrowCallbackValueNotReturned()
  1205  }
  1206  
  1207  type Request struct {
  1208  	// RequestId is "Request.requestId"
  1209  	//
  1210  	// Optional
  1211  	//
  1212  	// NOTE: FFI_USE_RequestId MUST be set to true to make this field effective.
  1213  	RequestId int32
  1214  	// Device is "Request.device"
  1215  	//
  1216  	// Optional
  1217  	//
  1218  	// NOTE: Device.FFI_USE MUST be set to true to get Device used.
  1219  	Device Device
  1220  	// Value is "Request.value"
  1221  	//
  1222  	// Optional
  1223  	Value js.ArrayBuffer
  1224  
  1225  	FFI_USE_RequestId bool // for RequestId.
  1226  
  1227  	FFI_USE bool
  1228  }
  1229  
  1230  // FromRef calls UpdateFrom and returns a Request with all fields set.
  1231  func (p Request) FromRef(ref js.Ref) Request {
  1232  	p.UpdateFrom(ref)
  1233  	return p
  1234  }
  1235  
  1236  // New creates a new Request in the application heap.
  1237  func (p Request) New() js.Ref {
  1238  	return bindings.RequestJSLoad(
  1239  		js.Pointer(&p), js.True, 0,
  1240  	)
  1241  }
  1242  
  1243  // UpdateFrom copies value of all fields of the heap object to p.
  1244  func (p *Request) UpdateFrom(ref js.Ref) {
  1245  	bindings.RequestJSStore(
  1246  		js.Pointer(p), ref,
  1247  	)
  1248  }
  1249  
  1250  // Update writes all fields of the p to the heap object referenced by ref.
  1251  func (p *Request) Update(ref js.Ref) {
  1252  	bindings.RequestJSLoad(
  1253  		js.Pointer(p), js.False, ref,
  1254  	)
  1255  }
  1256  
  1257  // FreeMembers frees fields with heap reference, if recursive is true
  1258  // free all heap references reachable from p.
  1259  func (p *Request) FreeMembers(recursive bool) {
  1260  	js.Free(
  1261  		p.Value.Ref(),
  1262  	)
  1263  	p.Value = p.Value.FromRef(js.Undefined)
  1264  	if recursive {
  1265  		p.Device.FreeMembers(true)
  1266  	}
  1267  }
  1268  
  1269  type Response struct {
  1270  	// RequestId is "Response.requestId"
  1271  	//
  1272  	// Optional
  1273  	//
  1274  	// NOTE: FFI_USE_RequestId MUST be set to true to make this field effective.
  1275  	RequestId int32
  1276  	// IsError is "Response.isError"
  1277  	//
  1278  	// Optional
  1279  	//
  1280  	// NOTE: FFI_USE_IsError MUST be set to true to make this field effective.
  1281  	IsError bool
  1282  	// Value is "Response.value"
  1283  	//
  1284  	// Optional
  1285  	Value js.ArrayBuffer
  1286  
  1287  	FFI_USE_RequestId bool // for RequestId.
  1288  	FFI_USE_IsError   bool // for IsError.
  1289  
  1290  	FFI_USE bool
  1291  }
  1292  
  1293  // FromRef calls UpdateFrom and returns a Response with all fields set.
  1294  func (p Response) FromRef(ref js.Ref) Response {
  1295  	p.UpdateFrom(ref)
  1296  	return p
  1297  }
  1298  
  1299  // New creates a new Response in the application heap.
  1300  func (p Response) New() js.Ref {
  1301  	return bindings.ResponseJSLoad(
  1302  		js.Pointer(&p), js.True, 0,
  1303  	)
  1304  }
  1305  
  1306  // UpdateFrom copies value of all fields of the heap object to p.
  1307  func (p *Response) UpdateFrom(ref js.Ref) {
  1308  	bindings.ResponseJSStore(
  1309  		js.Pointer(p), ref,
  1310  	)
  1311  }
  1312  
  1313  // Update writes all fields of the p to the heap object referenced by ref.
  1314  func (p *Response) Update(ref js.Ref) {
  1315  	bindings.ResponseJSLoad(
  1316  		js.Pointer(p), js.False, ref,
  1317  	)
  1318  }
  1319  
  1320  // FreeMembers frees fields with heap reference, if recursive is true
  1321  // free all heap references reachable from p.
  1322  func (p *Response) FreeMembers(recursive bool) {
  1323  	js.Free(
  1324  		p.Value.Ref(),
  1325  	)
  1326  	p.Value = p.Value.FromRef(js.Undefined)
  1327  }
  1328  
  1329  type ResultCallbackFunc func(this js.Ref) js.Ref
  1330  
  1331  func (fn ResultCallbackFunc) Register() js.Func[func()] {
  1332  	return js.RegisterCallback[func()](
  1333  		fn, abi.FuncPCABIInternal(fn),
  1334  	)
  1335  }
  1336  
  1337  func (fn ResultCallbackFunc) DispatchCallback(
  1338  	targetPC uintptr, ctx *js.CallbackContext,
  1339  ) {
  1340  	args := ctx.Args()
  1341  	if len(args) != 0+1 /* js this */ ||
  1342  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1343  		js.ThrowInvalidCallbackInvocation()
  1344  	}
  1345  
  1346  	if ctx.Return(fn(
  1347  		args[0],
  1348  	)) {
  1349  		return
  1350  	}
  1351  
  1352  	js.ThrowCallbackValueNotReturned()
  1353  }
  1354  
  1355  type ResultCallback[T any] struct {
  1356  	Fn  func(arg T, this js.Ref) js.Ref
  1357  	Arg T
  1358  }
  1359  
  1360  func (cb *ResultCallback[T]) Register() js.Func[func()] {
  1361  	return js.RegisterCallback[func()](
  1362  		cb, abi.FuncPCABIInternal(cb.Fn),
  1363  	)
  1364  }
  1365  
  1366  func (cb *ResultCallback[T]) DispatchCallback(
  1367  	targetPC uintptr, ctx *js.CallbackContext,
  1368  ) {
  1369  	args := ctx.Args()
  1370  	if len(args) != 0+1 /* js this */ ||
  1371  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1372  		js.ThrowInvalidCallbackInvocation()
  1373  	}
  1374  
  1375  	if ctx.Return(cb.Fn(
  1376  		cb.Arg,
  1377  		args[0],
  1378  	)) {
  1379  		return
  1380  	}
  1381  
  1382  	js.ThrowCallbackValueNotReturned()
  1383  }
  1384  
  1385  type ServiceCallbackFunc func(this js.Ref, result *Service) js.Ref
  1386  
  1387  func (fn ServiceCallbackFunc) Register() js.Func[func(result *Service)] {
  1388  	return js.RegisterCallback[func(result *Service)](
  1389  		fn, abi.FuncPCABIInternal(fn),
  1390  	)
  1391  }
  1392  
  1393  func (fn ServiceCallbackFunc) DispatchCallback(
  1394  	targetPC uintptr, ctx *js.CallbackContext,
  1395  ) {
  1396  	args := ctx.Args()
  1397  	if len(args) != 1+1 /* js this */ ||
  1398  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1399  		js.ThrowInvalidCallbackInvocation()
  1400  	}
  1401  	var arg0 Service
  1402  	arg0.UpdateFrom(args[0+1])
  1403  	defer arg0.FreeMembers(true)
  1404  
  1405  	if ctx.Return(fn(
  1406  		args[0],
  1407  
  1408  		mark.NoEscape(&arg0),
  1409  	)) {
  1410  		return
  1411  	}
  1412  
  1413  	js.ThrowCallbackValueNotReturned()
  1414  }
  1415  
  1416  type ServiceCallback[T any] struct {
  1417  	Fn  func(arg T, this js.Ref, result *Service) js.Ref
  1418  	Arg T
  1419  }
  1420  
  1421  func (cb *ServiceCallback[T]) Register() js.Func[func(result *Service)] {
  1422  	return js.RegisterCallback[func(result *Service)](
  1423  		cb, abi.FuncPCABIInternal(cb.Fn),
  1424  	)
  1425  }
  1426  
  1427  func (cb *ServiceCallback[T]) DispatchCallback(
  1428  	targetPC uintptr, ctx *js.CallbackContext,
  1429  ) {
  1430  	args := ctx.Args()
  1431  	if len(args) != 1+1 /* js this */ ||
  1432  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1433  		js.ThrowInvalidCallbackInvocation()
  1434  	}
  1435  	var arg0 Service
  1436  	arg0.UpdateFrom(args[0+1])
  1437  	defer arg0.FreeMembers(true)
  1438  
  1439  	if ctx.Return(cb.Fn(
  1440  		cb.Arg,
  1441  		args[0],
  1442  
  1443  		mark.NoEscape(&arg0),
  1444  	)) {
  1445  		return
  1446  	}
  1447  
  1448  	js.ThrowCallbackValueNotReturned()
  1449  }
  1450  
  1451  type ServicesCallbackFunc func(this js.Ref, result js.Array[Service]) js.Ref
  1452  
  1453  func (fn ServicesCallbackFunc) Register() js.Func[func(result js.Array[Service])] {
  1454  	return js.RegisterCallback[func(result js.Array[Service])](
  1455  		fn, abi.FuncPCABIInternal(fn),
  1456  	)
  1457  }
  1458  
  1459  func (fn ServicesCallbackFunc) DispatchCallback(
  1460  	targetPC uintptr, ctx *js.CallbackContext,
  1461  ) {
  1462  	args := ctx.Args()
  1463  	if len(args) != 1+1 /* js this */ ||
  1464  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1465  		js.ThrowInvalidCallbackInvocation()
  1466  	}
  1467  
  1468  	if ctx.Return(fn(
  1469  		args[0],
  1470  
  1471  		js.Array[Service]{}.FromRef(args[0+1]),
  1472  	)) {
  1473  		return
  1474  	}
  1475  
  1476  	js.ThrowCallbackValueNotReturned()
  1477  }
  1478  
  1479  type ServicesCallback[T any] struct {
  1480  	Fn  func(arg T, this js.Ref, result js.Array[Service]) js.Ref
  1481  	Arg T
  1482  }
  1483  
  1484  func (cb *ServicesCallback[T]) Register() js.Func[func(result js.Array[Service])] {
  1485  	return js.RegisterCallback[func(result js.Array[Service])](
  1486  		cb, abi.FuncPCABIInternal(cb.Fn),
  1487  	)
  1488  }
  1489  
  1490  func (cb *ServicesCallback[T]) DispatchCallback(
  1491  	targetPC uintptr, ctx *js.CallbackContext,
  1492  ) {
  1493  	args := ctx.Args()
  1494  	if len(args) != 1+1 /* js this */ ||
  1495  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1496  		js.ThrowInvalidCallbackInvocation()
  1497  	}
  1498  
  1499  	if ctx.Return(cb.Fn(
  1500  		cb.Arg,
  1501  		args[0],
  1502  
  1503  		js.Array[Service]{}.FromRef(args[0+1]),
  1504  	)) {
  1505  		return
  1506  	}
  1507  
  1508  	js.ThrowCallbackValueNotReturned()
  1509  }
  1510  
  1511  // HasFuncConnect returns true if the function "WEBEXT.bluetoothLowEnergy.connect" exists.
  1512  func HasFuncConnect() bool {
  1513  	return js.True == bindings.HasFuncConnect()
  1514  }
  1515  
  1516  // FuncConnect returns the function "WEBEXT.bluetoothLowEnergy.connect".
  1517  func FuncConnect() (fn js.Func[func(deviceAddress js.String, properties ConnectProperties) js.Promise[js.Void]]) {
  1518  	bindings.FuncConnect(
  1519  		js.Pointer(&fn),
  1520  	)
  1521  	return
  1522  }
  1523  
  1524  // Connect calls the function "WEBEXT.bluetoothLowEnergy.connect" directly.
  1525  func Connect(deviceAddress js.String, properties ConnectProperties) (ret js.Promise[js.Void]) {
  1526  	bindings.CallConnect(
  1527  		js.Pointer(&ret),
  1528  		deviceAddress.Ref(),
  1529  		js.Pointer(&properties),
  1530  	)
  1531  
  1532  	return
  1533  }
  1534  
  1535  // TryConnect calls the function "WEBEXT.bluetoothLowEnergy.connect"
  1536  // in a try/catch block and returns (_, err, ok = false) when it went through
  1537  // the catch clause.
  1538  func TryConnect(deviceAddress js.String, properties ConnectProperties) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1539  	ok = js.True == bindings.TryConnect(
  1540  		js.Pointer(&ret), js.Pointer(&exception),
  1541  		deviceAddress.Ref(),
  1542  		js.Pointer(&properties),
  1543  	)
  1544  
  1545  	return
  1546  }
  1547  
  1548  // HasFuncCreateCharacteristic returns true if the function "WEBEXT.bluetoothLowEnergy.createCharacteristic" exists.
  1549  func HasFuncCreateCharacteristic() bool {
  1550  	return js.True == bindings.HasFuncCreateCharacteristic()
  1551  }
  1552  
  1553  // FuncCreateCharacteristic returns the function "WEBEXT.bluetoothLowEnergy.createCharacteristic".
  1554  func FuncCreateCharacteristic() (fn js.Func[func(characteristic Characteristic, serviceId js.String) js.Promise[js.String]]) {
  1555  	bindings.FuncCreateCharacteristic(
  1556  		js.Pointer(&fn),
  1557  	)
  1558  	return
  1559  }
  1560  
  1561  // CreateCharacteristic calls the function "WEBEXT.bluetoothLowEnergy.createCharacteristic" directly.
  1562  func CreateCharacteristic(characteristic Characteristic, serviceId js.String) (ret js.Promise[js.String]) {
  1563  	bindings.CallCreateCharacteristic(
  1564  		js.Pointer(&ret),
  1565  		js.Pointer(&characteristic),
  1566  		serviceId.Ref(),
  1567  	)
  1568  
  1569  	return
  1570  }
  1571  
  1572  // TryCreateCharacteristic calls the function "WEBEXT.bluetoothLowEnergy.createCharacteristic"
  1573  // in a try/catch block and returns (_, err, ok = false) when it went through
  1574  // the catch clause.
  1575  func TryCreateCharacteristic(characteristic Characteristic, serviceId js.String) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1576  	ok = js.True == bindings.TryCreateCharacteristic(
  1577  		js.Pointer(&ret), js.Pointer(&exception),
  1578  		js.Pointer(&characteristic),
  1579  		serviceId.Ref(),
  1580  	)
  1581  
  1582  	return
  1583  }
  1584  
  1585  // HasFuncCreateDescriptor returns true if the function "WEBEXT.bluetoothLowEnergy.createDescriptor" exists.
  1586  func HasFuncCreateDescriptor() bool {
  1587  	return js.True == bindings.HasFuncCreateDescriptor()
  1588  }
  1589  
  1590  // FuncCreateDescriptor returns the function "WEBEXT.bluetoothLowEnergy.createDescriptor".
  1591  func FuncCreateDescriptor() (fn js.Func[func(descriptor Descriptor, characteristicId js.String) js.Promise[js.String]]) {
  1592  	bindings.FuncCreateDescriptor(
  1593  		js.Pointer(&fn),
  1594  	)
  1595  	return
  1596  }
  1597  
  1598  // CreateDescriptor calls the function "WEBEXT.bluetoothLowEnergy.createDescriptor" directly.
  1599  func CreateDescriptor(descriptor Descriptor, characteristicId js.String) (ret js.Promise[js.String]) {
  1600  	bindings.CallCreateDescriptor(
  1601  		js.Pointer(&ret),
  1602  		js.Pointer(&descriptor),
  1603  		characteristicId.Ref(),
  1604  	)
  1605  
  1606  	return
  1607  }
  1608  
  1609  // TryCreateDescriptor calls the function "WEBEXT.bluetoothLowEnergy.createDescriptor"
  1610  // in a try/catch block and returns (_, err, ok = false) when it went through
  1611  // the catch clause.
  1612  func TryCreateDescriptor(descriptor Descriptor, characteristicId js.String) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1613  	ok = js.True == bindings.TryCreateDescriptor(
  1614  		js.Pointer(&ret), js.Pointer(&exception),
  1615  		js.Pointer(&descriptor),
  1616  		characteristicId.Ref(),
  1617  	)
  1618  
  1619  	return
  1620  }
  1621  
  1622  // HasFuncCreateService returns true if the function "WEBEXT.bluetoothLowEnergy.createService" exists.
  1623  func HasFuncCreateService() bool {
  1624  	return js.True == bindings.HasFuncCreateService()
  1625  }
  1626  
  1627  // FuncCreateService returns the function "WEBEXT.bluetoothLowEnergy.createService".
  1628  func FuncCreateService() (fn js.Func[func(service Service) js.Promise[js.String]]) {
  1629  	bindings.FuncCreateService(
  1630  		js.Pointer(&fn),
  1631  	)
  1632  	return
  1633  }
  1634  
  1635  // CreateService calls the function "WEBEXT.bluetoothLowEnergy.createService" directly.
  1636  func CreateService(service Service) (ret js.Promise[js.String]) {
  1637  	bindings.CallCreateService(
  1638  		js.Pointer(&ret),
  1639  		js.Pointer(&service),
  1640  	)
  1641  
  1642  	return
  1643  }
  1644  
  1645  // TryCreateService calls the function "WEBEXT.bluetoothLowEnergy.createService"
  1646  // in a try/catch block and returns (_, err, ok = false) when it went through
  1647  // the catch clause.
  1648  func TryCreateService(service Service) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1649  	ok = js.True == bindings.TryCreateService(
  1650  		js.Pointer(&ret), js.Pointer(&exception),
  1651  		js.Pointer(&service),
  1652  	)
  1653  
  1654  	return
  1655  }
  1656  
  1657  // HasFuncDisconnect returns true if the function "WEBEXT.bluetoothLowEnergy.disconnect" exists.
  1658  func HasFuncDisconnect() bool {
  1659  	return js.True == bindings.HasFuncDisconnect()
  1660  }
  1661  
  1662  // FuncDisconnect returns the function "WEBEXT.bluetoothLowEnergy.disconnect".
  1663  func FuncDisconnect() (fn js.Func[func(deviceAddress js.String) js.Promise[js.Void]]) {
  1664  	bindings.FuncDisconnect(
  1665  		js.Pointer(&fn),
  1666  	)
  1667  	return
  1668  }
  1669  
  1670  // Disconnect calls the function "WEBEXT.bluetoothLowEnergy.disconnect" directly.
  1671  func Disconnect(deviceAddress js.String) (ret js.Promise[js.Void]) {
  1672  	bindings.CallDisconnect(
  1673  		js.Pointer(&ret),
  1674  		deviceAddress.Ref(),
  1675  	)
  1676  
  1677  	return
  1678  }
  1679  
  1680  // TryDisconnect calls the function "WEBEXT.bluetoothLowEnergy.disconnect"
  1681  // in a try/catch block and returns (_, err, ok = false) when it went through
  1682  // the catch clause.
  1683  func TryDisconnect(deviceAddress js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1684  	ok = js.True == bindings.TryDisconnect(
  1685  		js.Pointer(&ret), js.Pointer(&exception),
  1686  		deviceAddress.Ref(),
  1687  	)
  1688  
  1689  	return
  1690  }
  1691  
  1692  // HasFuncGetCharacteristic returns true if the function "WEBEXT.bluetoothLowEnergy.getCharacteristic" exists.
  1693  func HasFuncGetCharacteristic() bool {
  1694  	return js.True == bindings.HasFuncGetCharacteristic()
  1695  }
  1696  
  1697  // FuncGetCharacteristic returns the function "WEBEXT.bluetoothLowEnergy.getCharacteristic".
  1698  func FuncGetCharacteristic() (fn js.Func[func(characteristicId js.String) js.Promise[Characteristic]]) {
  1699  	bindings.FuncGetCharacteristic(
  1700  		js.Pointer(&fn),
  1701  	)
  1702  	return
  1703  }
  1704  
  1705  // GetCharacteristic calls the function "WEBEXT.bluetoothLowEnergy.getCharacteristic" directly.
  1706  func GetCharacteristic(characteristicId js.String) (ret js.Promise[Characteristic]) {
  1707  	bindings.CallGetCharacteristic(
  1708  		js.Pointer(&ret),
  1709  		characteristicId.Ref(),
  1710  	)
  1711  
  1712  	return
  1713  }
  1714  
  1715  // TryGetCharacteristic calls the function "WEBEXT.bluetoothLowEnergy.getCharacteristic"
  1716  // in a try/catch block and returns (_, err, ok = false) when it went through
  1717  // the catch clause.
  1718  func TryGetCharacteristic(characteristicId js.String) (ret js.Promise[Characteristic], exception js.Any, ok bool) {
  1719  	ok = js.True == bindings.TryGetCharacteristic(
  1720  		js.Pointer(&ret), js.Pointer(&exception),
  1721  		characteristicId.Ref(),
  1722  	)
  1723  
  1724  	return
  1725  }
  1726  
  1727  // HasFuncGetCharacteristics returns true if the function "WEBEXT.bluetoothLowEnergy.getCharacteristics" exists.
  1728  func HasFuncGetCharacteristics() bool {
  1729  	return js.True == bindings.HasFuncGetCharacteristics()
  1730  }
  1731  
  1732  // FuncGetCharacteristics returns the function "WEBEXT.bluetoothLowEnergy.getCharacteristics".
  1733  func FuncGetCharacteristics() (fn js.Func[func(serviceId js.String) js.Promise[js.Array[Characteristic]]]) {
  1734  	bindings.FuncGetCharacteristics(
  1735  		js.Pointer(&fn),
  1736  	)
  1737  	return
  1738  }
  1739  
  1740  // GetCharacteristics calls the function "WEBEXT.bluetoothLowEnergy.getCharacteristics" directly.
  1741  func GetCharacteristics(serviceId js.String) (ret js.Promise[js.Array[Characteristic]]) {
  1742  	bindings.CallGetCharacteristics(
  1743  		js.Pointer(&ret),
  1744  		serviceId.Ref(),
  1745  	)
  1746  
  1747  	return
  1748  }
  1749  
  1750  // TryGetCharacteristics calls the function "WEBEXT.bluetoothLowEnergy.getCharacteristics"
  1751  // in a try/catch block and returns (_, err, ok = false) when it went through
  1752  // the catch clause.
  1753  func TryGetCharacteristics(serviceId js.String) (ret js.Promise[js.Array[Characteristic]], exception js.Any, ok bool) {
  1754  	ok = js.True == bindings.TryGetCharacteristics(
  1755  		js.Pointer(&ret), js.Pointer(&exception),
  1756  		serviceId.Ref(),
  1757  	)
  1758  
  1759  	return
  1760  }
  1761  
  1762  // HasFuncGetDescriptor returns true if the function "WEBEXT.bluetoothLowEnergy.getDescriptor" exists.
  1763  func HasFuncGetDescriptor() bool {
  1764  	return js.True == bindings.HasFuncGetDescriptor()
  1765  }
  1766  
  1767  // FuncGetDescriptor returns the function "WEBEXT.bluetoothLowEnergy.getDescriptor".
  1768  func FuncGetDescriptor() (fn js.Func[func(descriptorId js.String) js.Promise[Descriptor]]) {
  1769  	bindings.FuncGetDescriptor(
  1770  		js.Pointer(&fn),
  1771  	)
  1772  	return
  1773  }
  1774  
  1775  // GetDescriptor calls the function "WEBEXT.bluetoothLowEnergy.getDescriptor" directly.
  1776  func GetDescriptor(descriptorId js.String) (ret js.Promise[Descriptor]) {
  1777  	bindings.CallGetDescriptor(
  1778  		js.Pointer(&ret),
  1779  		descriptorId.Ref(),
  1780  	)
  1781  
  1782  	return
  1783  }
  1784  
  1785  // TryGetDescriptor calls the function "WEBEXT.bluetoothLowEnergy.getDescriptor"
  1786  // in a try/catch block and returns (_, err, ok = false) when it went through
  1787  // the catch clause.
  1788  func TryGetDescriptor(descriptorId js.String) (ret js.Promise[Descriptor], exception js.Any, ok bool) {
  1789  	ok = js.True == bindings.TryGetDescriptor(
  1790  		js.Pointer(&ret), js.Pointer(&exception),
  1791  		descriptorId.Ref(),
  1792  	)
  1793  
  1794  	return
  1795  }
  1796  
  1797  // HasFuncGetDescriptors returns true if the function "WEBEXT.bluetoothLowEnergy.getDescriptors" exists.
  1798  func HasFuncGetDescriptors() bool {
  1799  	return js.True == bindings.HasFuncGetDescriptors()
  1800  }
  1801  
  1802  // FuncGetDescriptors returns the function "WEBEXT.bluetoothLowEnergy.getDescriptors".
  1803  func FuncGetDescriptors() (fn js.Func[func(characteristicId js.String) js.Promise[js.Array[Descriptor]]]) {
  1804  	bindings.FuncGetDescriptors(
  1805  		js.Pointer(&fn),
  1806  	)
  1807  	return
  1808  }
  1809  
  1810  // GetDescriptors calls the function "WEBEXT.bluetoothLowEnergy.getDescriptors" directly.
  1811  func GetDescriptors(characteristicId js.String) (ret js.Promise[js.Array[Descriptor]]) {
  1812  	bindings.CallGetDescriptors(
  1813  		js.Pointer(&ret),
  1814  		characteristicId.Ref(),
  1815  	)
  1816  
  1817  	return
  1818  }
  1819  
  1820  // TryGetDescriptors calls the function "WEBEXT.bluetoothLowEnergy.getDescriptors"
  1821  // in a try/catch block and returns (_, err, ok = false) when it went through
  1822  // the catch clause.
  1823  func TryGetDescriptors(characteristicId js.String) (ret js.Promise[js.Array[Descriptor]], exception js.Any, ok bool) {
  1824  	ok = js.True == bindings.TryGetDescriptors(
  1825  		js.Pointer(&ret), js.Pointer(&exception),
  1826  		characteristicId.Ref(),
  1827  	)
  1828  
  1829  	return
  1830  }
  1831  
  1832  // HasFuncGetIncludedServices returns true if the function "WEBEXT.bluetoothLowEnergy.getIncludedServices" exists.
  1833  func HasFuncGetIncludedServices() bool {
  1834  	return js.True == bindings.HasFuncGetIncludedServices()
  1835  }
  1836  
  1837  // FuncGetIncludedServices returns the function "WEBEXT.bluetoothLowEnergy.getIncludedServices".
  1838  func FuncGetIncludedServices() (fn js.Func[func(serviceId js.String) js.Promise[js.Array[Service]]]) {
  1839  	bindings.FuncGetIncludedServices(
  1840  		js.Pointer(&fn),
  1841  	)
  1842  	return
  1843  }
  1844  
  1845  // GetIncludedServices calls the function "WEBEXT.bluetoothLowEnergy.getIncludedServices" directly.
  1846  func GetIncludedServices(serviceId js.String) (ret js.Promise[js.Array[Service]]) {
  1847  	bindings.CallGetIncludedServices(
  1848  		js.Pointer(&ret),
  1849  		serviceId.Ref(),
  1850  	)
  1851  
  1852  	return
  1853  }
  1854  
  1855  // TryGetIncludedServices calls the function "WEBEXT.bluetoothLowEnergy.getIncludedServices"
  1856  // in a try/catch block and returns (_, err, ok = false) when it went through
  1857  // the catch clause.
  1858  func TryGetIncludedServices(serviceId js.String) (ret js.Promise[js.Array[Service]], exception js.Any, ok bool) {
  1859  	ok = js.True == bindings.TryGetIncludedServices(
  1860  		js.Pointer(&ret), js.Pointer(&exception),
  1861  		serviceId.Ref(),
  1862  	)
  1863  
  1864  	return
  1865  }
  1866  
  1867  // HasFuncGetService returns true if the function "WEBEXT.bluetoothLowEnergy.getService" exists.
  1868  func HasFuncGetService() bool {
  1869  	return js.True == bindings.HasFuncGetService()
  1870  }
  1871  
  1872  // FuncGetService returns the function "WEBEXT.bluetoothLowEnergy.getService".
  1873  func FuncGetService() (fn js.Func[func(serviceId js.String) js.Promise[Service]]) {
  1874  	bindings.FuncGetService(
  1875  		js.Pointer(&fn),
  1876  	)
  1877  	return
  1878  }
  1879  
  1880  // GetService calls the function "WEBEXT.bluetoothLowEnergy.getService" directly.
  1881  func GetService(serviceId js.String) (ret js.Promise[Service]) {
  1882  	bindings.CallGetService(
  1883  		js.Pointer(&ret),
  1884  		serviceId.Ref(),
  1885  	)
  1886  
  1887  	return
  1888  }
  1889  
  1890  // TryGetService calls the function "WEBEXT.bluetoothLowEnergy.getService"
  1891  // in a try/catch block and returns (_, err, ok = false) when it went through
  1892  // the catch clause.
  1893  func TryGetService(serviceId js.String) (ret js.Promise[Service], exception js.Any, ok bool) {
  1894  	ok = js.True == bindings.TryGetService(
  1895  		js.Pointer(&ret), js.Pointer(&exception),
  1896  		serviceId.Ref(),
  1897  	)
  1898  
  1899  	return
  1900  }
  1901  
  1902  // HasFuncGetServices returns true if the function "WEBEXT.bluetoothLowEnergy.getServices" exists.
  1903  func HasFuncGetServices() bool {
  1904  	return js.True == bindings.HasFuncGetServices()
  1905  }
  1906  
  1907  // FuncGetServices returns the function "WEBEXT.bluetoothLowEnergy.getServices".
  1908  func FuncGetServices() (fn js.Func[func(deviceAddress js.String) js.Promise[js.Array[Service]]]) {
  1909  	bindings.FuncGetServices(
  1910  		js.Pointer(&fn),
  1911  	)
  1912  	return
  1913  }
  1914  
  1915  // GetServices calls the function "WEBEXT.bluetoothLowEnergy.getServices" directly.
  1916  func GetServices(deviceAddress js.String) (ret js.Promise[js.Array[Service]]) {
  1917  	bindings.CallGetServices(
  1918  		js.Pointer(&ret),
  1919  		deviceAddress.Ref(),
  1920  	)
  1921  
  1922  	return
  1923  }
  1924  
  1925  // TryGetServices calls the function "WEBEXT.bluetoothLowEnergy.getServices"
  1926  // in a try/catch block and returns (_, err, ok = false) when it went through
  1927  // the catch clause.
  1928  func TryGetServices(deviceAddress js.String) (ret js.Promise[js.Array[Service]], exception js.Any, ok bool) {
  1929  	ok = js.True == bindings.TryGetServices(
  1930  		js.Pointer(&ret), js.Pointer(&exception),
  1931  		deviceAddress.Ref(),
  1932  	)
  1933  
  1934  	return
  1935  }
  1936  
  1937  // HasFuncNotifyCharacteristicValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.notifyCharacteristicValueChanged" exists.
  1938  func HasFuncNotifyCharacteristicValueChanged() bool {
  1939  	return js.True == bindings.HasFuncNotifyCharacteristicValueChanged()
  1940  }
  1941  
  1942  // FuncNotifyCharacteristicValueChanged returns the function "WEBEXT.bluetoothLowEnergy.notifyCharacteristicValueChanged".
  1943  func FuncNotifyCharacteristicValueChanged() (fn js.Func[func(characteristicId js.String, notification Notification) js.Promise[js.Void]]) {
  1944  	bindings.FuncNotifyCharacteristicValueChanged(
  1945  		js.Pointer(&fn),
  1946  	)
  1947  	return
  1948  }
  1949  
  1950  // NotifyCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.notifyCharacteristicValueChanged" directly.
  1951  func NotifyCharacteristicValueChanged(characteristicId js.String, notification Notification) (ret js.Promise[js.Void]) {
  1952  	bindings.CallNotifyCharacteristicValueChanged(
  1953  		js.Pointer(&ret),
  1954  		characteristicId.Ref(),
  1955  		js.Pointer(&notification),
  1956  	)
  1957  
  1958  	return
  1959  }
  1960  
  1961  // TryNotifyCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.notifyCharacteristicValueChanged"
  1962  // in a try/catch block and returns (_, err, ok = false) when it went through
  1963  // the catch clause.
  1964  func TryNotifyCharacteristicValueChanged(characteristicId js.String, notification Notification) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1965  	ok = js.True == bindings.TryNotifyCharacteristicValueChanged(
  1966  		js.Pointer(&ret), js.Pointer(&exception),
  1967  		characteristicId.Ref(),
  1968  		js.Pointer(&notification),
  1969  	)
  1970  
  1971  	return
  1972  }
  1973  
  1974  type OnCharacteristicReadRequestEventCallbackFunc func(this js.Ref, request *Request, characteristicId js.String) js.Ref
  1975  
  1976  func (fn OnCharacteristicReadRequestEventCallbackFunc) Register() js.Func[func(request *Request, characteristicId js.String)] {
  1977  	return js.RegisterCallback[func(request *Request, characteristicId js.String)](
  1978  		fn, abi.FuncPCABIInternal(fn),
  1979  	)
  1980  }
  1981  
  1982  func (fn OnCharacteristicReadRequestEventCallbackFunc) DispatchCallback(
  1983  	targetPC uintptr, ctx *js.CallbackContext,
  1984  ) {
  1985  	args := ctx.Args()
  1986  	if len(args) != 2+1 /* js this */ ||
  1987  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1988  		js.ThrowInvalidCallbackInvocation()
  1989  	}
  1990  	var arg0 Request
  1991  	arg0.UpdateFrom(args[0+1])
  1992  	defer arg0.FreeMembers(true)
  1993  
  1994  	if ctx.Return(fn(
  1995  		args[0],
  1996  
  1997  		mark.NoEscape(&arg0),
  1998  		js.String{}.FromRef(args[1+1]),
  1999  	)) {
  2000  		return
  2001  	}
  2002  
  2003  	js.ThrowCallbackValueNotReturned()
  2004  }
  2005  
  2006  type OnCharacteristicReadRequestEventCallback[T any] struct {
  2007  	Fn  func(arg T, this js.Ref, request *Request, characteristicId js.String) js.Ref
  2008  	Arg T
  2009  }
  2010  
  2011  func (cb *OnCharacteristicReadRequestEventCallback[T]) Register() js.Func[func(request *Request, characteristicId js.String)] {
  2012  	return js.RegisterCallback[func(request *Request, characteristicId js.String)](
  2013  		cb, abi.FuncPCABIInternal(cb.Fn),
  2014  	)
  2015  }
  2016  
  2017  func (cb *OnCharacteristicReadRequestEventCallback[T]) DispatchCallback(
  2018  	targetPC uintptr, ctx *js.CallbackContext,
  2019  ) {
  2020  	args := ctx.Args()
  2021  	if len(args) != 2+1 /* js this */ ||
  2022  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2023  		js.ThrowInvalidCallbackInvocation()
  2024  	}
  2025  	var arg0 Request
  2026  	arg0.UpdateFrom(args[0+1])
  2027  	defer arg0.FreeMembers(true)
  2028  
  2029  	if ctx.Return(cb.Fn(
  2030  		cb.Arg,
  2031  		args[0],
  2032  
  2033  		mark.NoEscape(&arg0),
  2034  		js.String{}.FromRef(args[1+1]),
  2035  	)) {
  2036  		return
  2037  	}
  2038  
  2039  	js.ThrowCallbackValueNotReturned()
  2040  }
  2041  
  2042  // HasFuncOnCharacteristicReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.addListener" exists.
  2043  func HasFuncOnCharacteristicReadRequest() bool {
  2044  	return js.True == bindings.HasFuncOnCharacteristicReadRequest()
  2045  }
  2046  
  2047  // FuncOnCharacteristicReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.addListener".
  2048  func FuncOnCharacteristicReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)])]) {
  2049  	bindings.FuncOnCharacteristicReadRequest(
  2050  		js.Pointer(&fn),
  2051  	)
  2052  	return
  2053  }
  2054  
  2055  // OnCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.addListener" directly.
  2056  func OnCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void) {
  2057  	bindings.CallOnCharacteristicReadRequest(
  2058  		js.Pointer(&ret),
  2059  		callback.Ref(),
  2060  	)
  2061  
  2062  	return
  2063  }
  2064  
  2065  // TryOnCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.addListener"
  2066  // in a try/catch block and returns (_, err, ok = false) when it went through
  2067  // the catch clause.
  2068  func TryOnCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2069  	ok = js.True == bindings.TryOnCharacteristicReadRequest(
  2070  		js.Pointer(&ret), js.Pointer(&exception),
  2071  		callback.Ref(),
  2072  	)
  2073  
  2074  	return
  2075  }
  2076  
  2077  // HasFuncOffCharacteristicReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.removeListener" exists.
  2078  func HasFuncOffCharacteristicReadRequest() bool {
  2079  	return js.True == bindings.HasFuncOffCharacteristicReadRequest()
  2080  }
  2081  
  2082  // FuncOffCharacteristicReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.removeListener".
  2083  func FuncOffCharacteristicReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)])]) {
  2084  	bindings.FuncOffCharacteristicReadRequest(
  2085  		js.Pointer(&fn),
  2086  	)
  2087  	return
  2088  }
  2089  
  2090  // OffCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.removeListener" directly.
  2091  func OffCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void) {
  2092  	bindings.CallOffCharacteristicReadRequest(
  2093  		js.Pointer(&ret),
  2094  		callback.Ref(),
  2095  	)
  2096  
  2097  	return
  2098  }
  2099  
  2100  // TryOffCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.removeListener"
  2101  // in a try/catch block and returns (_, err, ok = false) when it went through
  2102  // the catch clause.
  2103  func TryOffCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2104  	ok = js.True == bindings.TryOffCharacteristicReadRequest(
  2105  		js.Pointer(&ret), js.Pointer(&exception),
  2106  		callback.Ref(),
  2107  	)
  2108  
  2109  	return
  2110  }
  2111  
  2112  // HasFuncHasOnCharacteristicReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.hasListener" exists.
  2113  func HasFuncHasOnCharacteristicReadRequest() bool {
  2114  	return js.True == bindings.HasFuncHasOnCharacteristicReadRequest()
  2115  }
  2116  
  2117  // FuncHasOnCharacteristicReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.hasListener".
  2118  func FuncHasOnCharacteristicReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)]) bool]) {
  2119  	bindings.FuncHasOnCharacteristicReadRequest(
  2120  		js.Pointer(&fn),
  2121  	)
  2122  	return
  2123  }
  2124  
  2125  // HasOnCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.hasListener" directly.
  2126  func HasOnCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret bool) {
  2127  	bindings.CallHasOnCharacteristicReadRequest(
  2128  		js.Pointer(&ret),
  2129  		callback.Ref(),
  2130  	)
  2131  
  2132  	return
  2133  }
  2134  
  2135  // TryHasOnCharacteristicReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicReadRequest.hasListener"
  2136  // in a try/catch block and returns (_, err, ok = false) when it went through
  2137  // the catch clause.
  2138  func TryHasOnCharacteristicReadRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret bool, exception js.Any, ok bool) {
  2139  	ok = js.True == bindings.TryHasOnCharacteristicReadRequest(
  2140  		js.Pointer(&ret), js.Pointer(&exception),
  2141  		callback.Ref(),
  2142  	)
  2143  
  2144  	return
  2145  }
  2146  
  2147  type OnCharacteristicValueChangedEventCallbackFunc func(this js.Ref, characteristic *Characteristic) js.Ref
  2148  
  2149  func (fn OnCharacteristicValueChangedEventCallbackFunc) Register() js.Func[func(characteristic *Characteristic)] {
  2150  	return js.RegisterCallback[func(characteristic *Characteristic)](
  2151  		fn, abi.FuncPCABIInternal(fn),
  2152  	)
  2153  }
  2154  
  2155  func (fn OnCharacteristicValueChangedEventCallbackFunc) DispatchCallback(
  2156  	targetPC uintptr, ctx *js.CallbackContext,
  2157  ) {
  2158  	args := ctx.Args()
  2159  	if len(args) != 1+1 /* js this */ ||
  2160  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2161  		js.ThrowInvalidCallbackInvocation()
  2162  	}
  2163  	var arg0 Characteristic
  2164  	arg0.UpdateFrom(args[0+1])
  2165  	defer arg0.FreeMembers(true)
  2166  
  2167  	if ctx.Return(fn(
  2168  		args[0],
  2169  
  2170  		mark.NoEscape(&arg0),
  2171  	)) {
  2172  		return
  2173  	}
  2174  
  2175  	js.ThrowCallbackValueNotReturned()
  2176  }
  2177  
  2178  type OnCharacteristicValueChangedEventCallback[T any] struct {
  2179  	Fn  func(arg T, this js.Ref, characteristic *Characteristic) js.Ref
  2180  	Arg T
  2181  }
  2182  
  2183  func (cb *OnCharacteristicValueChangedEventCallback[T]) Register() js.Func[func(characteristic *Characteristic)] {
  2184  	return js.RegisterCallback[func(characteristic *Characteristic)](
  2185  		cb, abi.FuncPCABIInternal(cb.Fn),
  2186  	)
  2187  }
  2188  
  2189  func (cb *OnCharacteristicValueChangedEventCallback[T]) DispatchCallback(
  2190  	targetPC uintptr, ctx *js.CallbackContext,
  2191  ) {
  2192  	args := ctx.Args()
  2193  	if len(args) != 1+1 /* js this */ ||
  2194  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2195  		js.ThrowInvalidCallbackInvocation()
  2196  	}
  2197  	var arg0 Characteristic
  2198  	arg0.UpdateFrom(args[0+1])
  2199  	defer arg0.FreeMembers(true)
  2200  
  2201  	if ctx.Return(cb.Fn(
  2202  		cb.Arg,
  2203  		args[0],
  2204  
  2205  		mark.NoEscape(&arg0),
  2206  	)) {
  2207  		return
  2208  	}
  2209  
  2210  	js.ThrowCallbackValueNotReturned()
  2211  }
  2212  
  2213  // HasFuncOnCharacteristicValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.addListener" exists.
  2214  func HasFuncOnCharacteristicValueChanged() bool {
  2215  	return js.True == bindings.HasFuncOnCharacteristicValueChanged()
  2216  }
  2217  
  2218  // FuncOnCharacteristicValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.addListener".
  2219  func FuncOnCharacteristicValueChanged() (fn js.Func[func(callback js.Func[func(characteristic *Characteristic)])]) {
  2220  	bindings.FuncOnCharacteristicValueChanged(
  2221  		js.Pointer(&fn),
  2222  	)
  2223  	return
  2224  }
  2225  
  2226  // OnCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.addListener" directly.
  2227  func OnCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret js.Void) {
  2228  	bindings.CallOnCharacteristicValueChanged(
  2229  		js.Pointer(&ret),
  2230  		callback.Ref(),
  2231  	)
  2232  
  2233  	return
  2234  }
  2235  
  2236  // TryOnCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.addListener"
  2237  // in a try/catch block and returns (_, err, ok = false) when it went through
  2238  // the catch clause.
  2239  func TryOnCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret js.Void, exception js.Any, ok bool) {
  2240  	ok = js.True == bindings.TryOnCharacteristicValueChanged(
  2241  		js.Pointer(&ret), js.Pointer(&exception),
  2242  		callback.Ref(),
  2243  	)
  2244  
  2245  	return
  2246  }
  2247  
  2248  // HasFuncOffCharacteristicValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.removeListener" exists.
  2249  func HasFuncOffCharacteristicValueChanged() bool {
  2250  	return js.True == bindings.HasFuncOffCharacteristicValueChanged()
  2251  }
  2252  
  2253  // FuncOffCharacteristicValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.removeListener".
  2254  func FuncOffCharacteristicValueChanged() (fn js.Func[func(callback js.Func[func(characteristic *Characteristic)])]) {
  2255  	bindings.FuncOffCharacteristicValueChanged(
  2256  		js.Pointer(&fn),
  2257  	)
  2258  	return
  2259  }
  2260  
  2261  // OffCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.removeListener" directly.
  2262  func OffCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret js.Void) {
  2263  	bindings.CallOffCharacteristicValueChanged(
  2264  		js.Pointer(&ret),
  2265  		callback.Ref(),
  2266  	)
  2267  
  2268  	return
  2269  }
  2270  
  2271  // TryOffCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.removeListener"
  2272  // in a try/catch block and returns (_, err, ok = false) when it went through
  2273  // the catch clause.
  2274  func TryOffCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret js.Void, exception js.Any, ok bool) {
  2275  	ok = js.True == bindings.TryOffCharacteristicValueChanged(
  2276  		js.Pointer(&ret), js.Pointer(&exception),
  2277  		callback.Ref(),
  2278  	)
  2279  
  2280  	return
  2281  }
  2282  
  2283  // HasFuncHasOnCharacteristicValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.hasListener" exists.
  2284  func HasFuncHasOnCharacteristicValueChanged() bool {
  2285  	return js.True == bindings.HasFuncHasOnCharacteristicValueChanged()
  2286  }
  2287  
  2288  // FuncHasOnCharacteristicValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.hasListener".
  2289  func FuncHasOnCharacteristicValueChanged() (fn js.Func[func(callback js.Func[func(characteristic *Characteristic)]) bool]) {
  2290  	bindings.FuncHasOnCharacteristicValueChanged(
  2291  		js.Pointer(&fn),
  2292  	)
  2293  	return
  2294  }
  2295  
  2296  // HasOnCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.hasListener" directly.
  2297  func HasOnCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret bool) {
  2298  	bindings.CallHasOnCharacteristicValueChanged(
  2299  		js.Pointer(&ret),
  2300  		callback.Ref(),
  2301  	)
  2302  
  2303  	return
  2304  }
  2305  
  2306  // TryHasOnCharacteristicValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicValueChanged.hasListener"
  2307  // in a try/catch block and returns (_, err, ok = false) when it went through
  2308  // the catch clause.
  2309  func TryHasOnCharacteristicValueChanged(callback js.Func[func(characteristic *Characteristic)]) (ret bool, exception js.Any, ok bool) {
  2310  	ok = js.True == bindings.TryHasOnCharacteristicValueChanged(
  2311  		js.Pointer(&ret), js.Pointer(&exception),
  2312  		callback.Ref(),
  2313  	)
  2314  
  2315  	return
  2316  }
  2317  
  2318  type OnCharacteristicWriteRequestEventCallbackFunc func(this js.Ref, request *Request, characteristicId js.String) js.Ref
  2319  
  2320  func (fn OnCharacteristicWriteRequestEventCallbackFunc) Register() js.Func[func(request *Request, characteristicId js.String)] {
  2321  	return js.RegisterCallback[func(request *Request, characteristicId js.String)](
  2322  		fn, abi.FuncPCABIInternal(fn),
  2323  	)
  2324  }
  2325  
  2326  func (fn OnCharacteristicWriteRequestEventCallbackFunc) DispatchCallback(
  2327  	targetPC uintptr, ctx *js.CallbackContext,
  2328  ) {
  2329  	args := ctx.Args()
  2330  	if len(args) != 2+1 /* js this */ ||
  2331  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2332  		js.ThrowInvalidCallbackInvocation()
  2333  	}
  2334  	var arg0 Request
  2335  	arg0.UpdateFrom(args[0+1])
  2336  	defer arg0.FreeMembers(true)
  2337  
  2338  	if ctx.Return(fn(
  2339  		args[0],
  2340  
  2341  		mark.NoEscape(&arg0),
  2342  		js.String{}.FromRef(args[1+1]),
  2343  	)) {
  2344  		return
  2345  	}
  2346  
  2347  	js.ThrowCallbackValueNotReturned()
  2348  }
  2349  
  2350  type OnCharacteristicWriteRequestEventCallback[T any] struct {
  2351  	Fn  func(arg T, this js.Ref, request *Request, characteristicId js.String) js.Ref
  2352  	Arg T
  2353  }
  2354  
  2355  func (cb *OnCharacteristicWriteRequestEventCallback[T]) Register() js.Func[func(request *Request, characteristicId js.String)] {
  2356  	return js.RegisterCallback[func(request *Request, characteristicId js.String)](
  2357  		cb, abi.FuncPCABIInternal(cb.Fn),
  2358  	)
  2359  }
  2360  
  2361  func (cb *OnCharacteristicWriteRequestEventCallback[T]) DispatchCallback(
  2362  	targetPC uintptr, ctx *js.CallbackContext,
  2363  ) {
  2364  	args := ctx.Args()
  2365  	if len(args) != 2+1 /* js this */ ||
  2366  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2367  		js.ThrowInvalidCallbackInvocation()
  2368  	}
  2369  	var arg0 Request
  2370  	arg0.UpdateFrom(args[0+1])
  2371  	defer arg0.FreeMembers(true)
  2372  
  2373  	if ctx.Return(cb.Fn(
  2374  		cb.Arg,
  2375  		args[0],
  2376  
  2377  		mark.NoEscape(&arg0),
  2378  		js.String{}.FromRef(args[1+1]),
  2379  	)) {
  2380  		return
  2381  	}
  2382  
  2383  	js.ThrowCallbackValueNotReturned()
  2384  }
  2385  
  2386  // HasFuncOnCharacteristicWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.addListener" exists.
  2387  func HasFuncOnCharacteristicWriteRequest() bool {
  2388  	return js.True == bindings.HasFuncOnCharacteristicWriteRequest()
  2389  }
  2390  
  2391  // FuncOnCharacteristicWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.addListener".
  2392  func FuncOnCharacteristicWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)])]) {
  2393  	bindings.FuncOnCharacteristicWriteRequest(
  2394  		js.Pointer(&fn),
  2395  	)
  2396  	return
  2397  }
  2398  
  2399  // OnCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.addListener" directly.
  2400  func OnCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void) {
  2401  	bindings.CallOnCharacteristicWriteRequest(
  2402  		js.Pointer(&ret),
  2403  		callback.Ref(),
  2404  	)
  2405  
  2406  	return
  2407  }
  2408  
  2409  // TryOnCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.addListener"
  2410  // in a try/catch block and returns (_, err, ok = false) when it went through
  2411  // the catch clause.
  2412  func TryOnCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2413  	ok = js.True == bindings.TryOnCharacteristicWriteRequest(
  2414  		js.Pointer(&ret), js.Pointer(&exception),
  2415  		callback.Ref(),
  2416  	)
  2417  
  2418  	return
  2419  }
  2420  
  2421  // HasFuncOffCharacteristicWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.removeListener" exists.
  2422  func HasFuncOffCharacteristicWriteRequest() bool {
  2423  	return js.True == bindings.HasFuncOffCharacteristicWriteRequest()
  2424  }
  2425  
  2426  // FuncOffCharacteristicWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.removeListener".
  2427  func FuncOffCharacteristicWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)])]) {
  2428  	bindings.FuncOffCharacteristicWriteRequest(
  2429  		js.Pointer(&fn),
  2430  	)
  2431  	return
  2432  }
  2433  
  2434  // OffCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.removeListener" directly.
  2435  func OffCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void) {
  2436  	bindings.CallOffCharacteristicWriteRequest(
  2437  		js.Pointer(&ret),
  2438  		callback.Ref(),
  2439  	)
  2440  
  2441  	return
  2442  }
  2443  
  2444  // TryOffCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.removeListener"
  2445  // in a try/catch block and returns (_, err, ok = false) when it went through
  2446  // the catch clause.
  2447  func TryOffCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2448  	ok = js.True == bindings.TryOffCharacteristicWriteRequest(
  2449  		js.Pointer(&ret), js.Pointer(&exception),
  2450  		callback.Ref(),
  2451  	)
  2452  
  2453  	return
  2454  }
  2455  
  2456  // HasFuncHasOnCharacteristicWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.hasListener" exists.
  2457  func HasFuncHasOnCharacteristicWriteRequest() bool {
  2458  	return js.True == bindings.HasFuncHasOnCharacteristicWriteRequest()
  2459  }
  2460  
  2461  // FuncHasOnCharacteristicWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.hasListener".
  2462  func FuncHasOnCharacteristicWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, characteristicId js.String)]) bool]) {
  2463  	bindings.FuncHasOnCharacteristicWriteRequest(
  2464  		js.Pointer(&fn),
  2465  	)
  2466  	return
  2467  }
  2468  
  2469  // HasOnCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.hasListener" directly.
  2470  func HasOnCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret bool) {
  2471  	bindings.CallHasOnCharacteristicWriteRequest(
  2472  		js.Pointer(&ret),
  2473  		callback.Ref(),
  2474  	)
  2475  
  2476  	return
  2477  }
  2478  
  2479  // TryHasOnCharacteristicWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onCharacteristicWriteRequest.hasListener"
  2480  // in a try/catch block and returns (_, err, ok = false) when it went through
  2481  // the catch clause.
  2482  func TryHasOnCharacteristicWriteRequest(callback js.Func[func(request *Request, characteristicId js.String)]) (ret bool, exception js.Any, ok bool) {
  2483  	ok = js.True == bindings.TryHasOnCharacteristicWriteRequest(
  2484  		js.Pointer(&ret), js.Pointer(&exception),
  2485  		callback.Ref(),
  2486  	)
  2487  
  2488  	return
  2489  }
  2490  
  2491  type OnDescriptorReadRequestEventCallbackFunc func(this js.Ref, request *Request, descriptorId js.String) js.Ref
  2492  
  2493  func (fn OnDescriptorReadRequestEventCallbackFunc) Register() js.Func[func(request *Request, descriptorId js.String)] {
  2494  	return js.RegisterCallback[func(request *Request, descriptorId js.String)](
  2495  		fn, abi.FuncPCABIInternal(fn),
  2496  	)
  2497  }
  2498  
  2499  func (fn OnDescriptorReadRequestEventCallbackFunc) DispatchCallback(
  2500  	targetPC uintptr, ctx *js.CallbackContext,
  2501  ) {
  2502  	args := ctx.Args()
  2503  	if len(args) != 2+1 /* js this */ ||
  2504  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2505  		js.ThrowInvalidCallbackInvocation()
  2506  	}
  2507  	var arg0 Request
  2508  	arg0.UpdateFrom(args[0+1])
  2509  	defer arg0.FreeMembers(true)
  2510  
  2511  	if ctx.Return(fn(
  2512  		args[0],
  2513  
  2514  		mark.NoEscape(&arg0),
  2515  		js.String{}.FromRef(args[1+1]),
  2516  	)) {
  2517  		return
  2518  	}
  2519  
  2520  	js.ThrowCallbackValueNotReturned()
  2521  }
  2522  
  2523  type OnDescriptorReadRequestEventCallback[T any] struct {
  2524  	Fn  func(arg T, this js.Ref, request *Request, descriptorId js.String) js.Ref
  2525  	Arg T
  2526  }
  2527  
  2528  func (cb *OnDescriptorReadRequestEventCallback[T]) Register() js.Func[func(request *Request, descriptorId js.String)] {
  2529  	return js.RegisterCallback[func(request *Request, descriptorId js.String)](
  2530  		cb, abi.FuncPCABIInternal(cb.Fn),
  2531  	)
  2532  }
  2533  
  2534  func (cb *OnDescriptorReadRequestEventCallback[T]) DispatchCallback(
  2535  	targetPC uintptr, ctx *js.CallbackContext,
  2536  ) {
  2537  	args := ctx.Args()
  2538  	if len(args) != 2+1 /* js this */ ||
  2539  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2540  		js.ThrowInvalidCallbackInvocation()
  2541  	}
  2542  	var arg0 Request
  2543  	arg0.UpdateFrom(args[0+1])
  2544  	defer arg0.FreeMembers(true)
  2545  
  2546  	if ctx.Return(cb.Fn(
  2547  		cb.Arg,
  2548  		args[0],
  2549  
  2550  		mark.NoEscape(&arg0),
  2551  		js.String{}.FromRef(args[1+1]),
  2552  	)) {
  2553  		return
  2554  	}
  2555  
  2556  	js.ThrowCallbackValueNotReturned()
  2557  }
  2558  
  2559  // HasFuncOnDescriptorReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.addListener" exists.
  2560  func HasFuncOnDescriptorReadRequest() bool {
  2561  	return js.True == bindings.HasFuncOnDescriptorReadRequest()
  2562  }
  2563  
  2564  // FuncOnDescriptorReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.addListener".
  2565  func FuncOnDescriptorReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)])]) {
  2566  	bindings.FuncOnDescriptorReadRequest(
  2567  		js.Pointer(&fn),
  2568  	)
  2569  	return
  2570  }
  2571  
  2572  // OnDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.addListener" directly.
  2573  func OnDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void) {
  2574  	bindings.CallOnDescriptorReadRequest(
  2575  		js.Pointer(&ret),
  2576  		callback.Ref(),
  2577  	)
  2578  
  2579  	return
  2580  }
  2581  
  2582  // TryOnDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.addListener"
  2583  // in a try/catch block and returns (_, err, ok = false) when it went through
  2584  // the catch clause.
  2585  func TryOnDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2586  	ok = js.True == bindings.TryOnDescriptorReadRequest(
  2587  		js.Pointer(&ret), js.Pointer(&exception),
  2588  		callback.Ref(),
  2589  	)
  2590  
  2591  	return
  2592  }
  2593  
  2594  // HasFuncOffDescriptorReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.removeListener" exists.
  2595  func HasFuncOffDescriptorReadRequest() bool {
  2596  	return js.True == bindings.HasFuncOffDescriptorReadRequest()
  2597  }
  2598  
  2599  // FuncOffDescriptorReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.removeListener".
  2600  func FuncOffDescriptorReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)])]) {
  2601  	bindings.FuncOffDescriptorReadRequest(
  2602  		js.Pointer(&fn),
  2603  	)
  2604  	return
  2605  }
  2606  
  2607  // OffDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.removeListener" directly.
  2608  func OffDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void) {
  2609  	bindings.CallOffDescriptorReadRequest(
  2610  		js.Pointer(&ret),
  2611  		callback.Ref(),
  2612  	)
  2613  
  2614  	return
  2615  }
  2616  
  2617  // TryOffDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.removeListener"
  2618  // in a try/catch block and returns (_, err, ok = false) when it went through
  2619  // the catch clause.
  2620  func TryOffDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2621  	ok = js.True == bindings.TryOffDescriptorReadRequest(
  2622  		js.Pointer(&ret), js.Pointer(&exception),
  2623  		callback.Ref(),
  2624  	)
  2625  
  2626  	return
  2627  }
  2628  
  2629  // HasFuncHasOnDescriptorReadRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.hasListener" exists.
  2630  func HasFuncHasOnDescriptorReadRequest() bool {
  2631  	return js.True == bindings.HasFuncHasOnDescriptorReadRequest()
  2632  }
  2633  
  2634  // FuncHasOnDescriptorReadRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.hasListener".
  2635  func FuncHasOnDescriptorReadRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)]) bool]) {
  2636  	bindings.FuncHasOnDescriptorReadRequest(
  2637  		js.Pointer(&fn),
  2638  	)
  2639  	return
  2640  }
  2641  
  2642  // HasOnDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.hasListener" directly.
  2643  func HasOnDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret bool) {
  2644  	bindings.CallHasOnDescriptorReadRequest(
  2645  		js.Pointer(&ret),
  2646  		callback.Ref(),
  2647  	)
  2648  
  2649  	return
  2650  }
  2651  
  2652  // TryHasOnDescriptorReadRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorReadRequest.hasListener"
  2653  // in a try/catch block and returns (_, err, ok = false) when it went through
  2654  // the catch clause.
  2655  func TryHasOnDescriptorReadRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret bool, exception js.Any, ok bool) {
  2656  	ok = js.True == bindings.TryHasOnDescriptorReadRequest(
  2657  		js.Pointer(&ret), js.Pointer(&exception),
  2658  		callback.Ref(),
  2659  	)
  2660  
  2661  	return
  2662  }
  2663  
  2664  type OnDescriptorValueChangedEventCallbackFunc func(this js.Ref, descriptor *Descriptor) js.Ref
  2665  
  2666  func (fn OnDescriptorValueChangedEventCallbackFunc) Register() js.Func[func(descriptor *Descriptor)] {
  2667  	return js.RegisterCallback[func(descriptor *Descriptor)](
  2668  		fn, abi.FuncPCABIInternal(fn),
  2669  	)
  2670  }
  2671  
  2672  func (fn OnDescriptorValueChangedEventCallbackFunc) DispatchCallback(
  2673  	targetPC uintptr, ctx *js.CallbackContext,
  2674  ) {
  2675  	args := ctx.Args()
  2676  	if len(args) != 1+1 /* js this */ ||
  2677  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2678  		js.ThrowInvalidCallbackInvocation()
  2679  	}
  2680  	var arg0 Descriptor
  2681  	arg0.UpdateFrom(args[0+1])
  2682  	defer arg0.FreeMembers(true)
  2683  
  2684  	if ctx.Return(fn(
  2685  		args[0],
  2686  
  2687  		mark.NoEscape(&arg0),
  2688  	)) {
  2689  		return
  2690  	}
  2691  
  2692  	js.ThrowCallbackValueNotReturned()
  2693  }
  2694  
  2695  type OnDescriptorValueChangedEventCallback[T any] struct {
  2696  	Fn  func(arg T, this js.Ref, descriptor *Descriptor) js.Ref
  2697  	Arg T
  2698  }
  2699  
  2700  func (cb *OnDescriptorValueChangedEventCallback[T]) Register() js.Func[func(descriptor *Descriptor)] {
  2701  	return js.RegisterCallback[func(descriptor *Descriptor)](
  2702  		cb, abi.FuncPCABIInternal(cb.Fn),
  2703  	)
  2704  }
  2705  
  2706  func (cb *OnDescriptorValueChangedEventCallback[T]) DispatchCallback(
  2707  	targetPC uintptr, ctx *js.CallbackContext,
  2708  ) {
  2709  	args := ctx.Args()
  2710  	if len(args) != 1+1 /* js this */ ||
  2711  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2712  		js.ThrowInvalidCallbackInvocation()
  2713  	}
  2714  	var arg0 Descriptor
  2715  	arg0.UpdateFrom(args[0+1])
  2716  	defer arg0.FreeMembers(true)
  2717  
  2718  	if ctx.Return(cb.Fn(
  2719  		cb.Arg,
  2720  		args[0],
  2721  
  2722  		mark.NoEscape(&arg0),
  2723  	)) {
  2724  		return
  2725  	}
  2726  
  2727  	js.ThrowCallbackValueNotReturned()
  2728  }
  2729  
  2730  // HasFuncOnDescriptorValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.addListener" exists.
  2731  func HasFuncOnDescriptorValueChanged() bool {
  2732  	return js.True == bindings.HasFuncOnDescriptorValueChanged()
  2733  }
  2734  
  2735  // FuncOnDescriptorValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.addListener".
  2736  func FuncOnDescriptorValueChanged() (fn js.Func[func(callback js.Func[func(descriptor *Descriptor)])]) {
  2737  	bindings.FuncOnDescriptorValueChanged(
  2738  		js.Pointer(&fn),
  2739  	)
  2740  	return
  2741  }
  2742  
  2743  // OnDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.addListener" directly.
  2744  func OnDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret js.Void) {
  2745  	bindings.CallOnDescriptorValueChanged(
  2746  		js.Pointer(&ret),
  2747  		callback.Ref(),
  2748  	)
  2749  
  2750  	return
  2751  }
  2752  
  2753  // TryOnDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.addListener"
  2754  // in a try/catch block and returns (_, err, ok = false) when it went through
  2755  // the catch clause.
  2756  func TryOnDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret js.Void, exception js.Any, ok bool) {
  2757  	ok = js.True == bindings.TryOnDescriptorValueChanged(
  2758  		js.Pointer(&ret), js.Pointer(&exception),
  2759  		callback.Ref(),
  2760  	)
  2761  
  2762  	return
  2763  }
  2764  
  2765  // HasFuncOffDescriptorValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.removeListener" exists.
  2766  func HasFuncOffDescriptorValueChanged() bool {
  2767  	return js.True == bindings.HasFuncOffDescriptorValueChanged()
  2768  }
  2769  
  2770  // FuncOffDescriptorValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.removeListener".
  2771  func FuncOffDescriptorValueChanged() (fn js.Func[func(callback js.Func[func(descriptor *Descriptor)])]) {
  2772  	bindings.FuncOffDescriptorValueChanged(
  2773  		js.Pointer(&fn),
  2774  	)
  2775  	return
  2776  }
  2777  
  2778  // OffDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.removeListener" directly.
  2779  func OffDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret js.Void) {
  2780  	bindings.CallOffDescriptorValueChanged(
  2781  		js.Pointer(&ret),
  2782  		callback.Ref(),
  2783  	)
  2784  
  2785  	return
  2786  }
  2787  
  2788  // TryOffDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.removeListener"
  2789  // in a try/catch block and returns (_, err, ok = false) when it went through
  2790  // the catch clause.
  2791  func TryOffDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret js.Void, exception js.Any, ok bool) {
  2792  	ok = js.True == bindings.TryOffDescriptorValueChanged(
  2793  		js.Pointer(&ret), js.Pointer(&exception),
  2794  		callback.Ref(),
  2795  	)
  2796  
  2797  	return
  2798  }
  2799  
  2800  // HasFuncHasOnDescriptorValueChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.hasListener" exists.
  2801  func HasFuncHasOnDescriptorValueChanged() bool {
  2802  	return js.True == bindings.HasFuncHasOnDescriptorValueChanged()
  2803  }
  2804  
  2805  // FuncHasOnDescriptorValueChanged returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.hasListener".
  2806  func FuncHasOnDescriptorValueChanged() (fn js.Func[func(callback js.Func[func(descriptor *Descriptor)]) bool]) {
  2807  	bindings.FuncHasOnDescriptorValueChanged(
  2808  		js.Pointer(&fn),
  2809  	)
  2810  	return
  2811  }
  2812  
  2813  // HasOnDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.hasListener" directly.
  2814  func HasOnDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret bool) {
  2815  	bindings.CallHasOnDescriptorValueChanged(
  2816  		js.Pointer(&ret),
  2817  		callback.Ref(),
  2818  	)
  2819  
  2820  	return
  2821  }
  2822  
  2823  // TryHasOnDescriptorValueChanged calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorValueChanged.hasListener"
  2824  // in a try/catch block and returns (_, err, ok = false) when it went through
  2825  // the catch clause.
  2826  func TryHasOnDescriptorValueChanged(callback js.Func[func(descriptor *Descriptor)]) (ret bool, exception js.Any, ok bool) {
  2827  	ok = js.True == bindings.TryHasOnDescriptorValueChanged(
  2828  		js.Pointer(&ret), js.Pointer(&exception),
  2829  		callback.Ref(),
  2830  	)
  2831  
  2832  	return
  2833  }
  2834  
  2835  type OnDescriptorWriteRequestEventCallbackFunc func(this js.Ref, request *Request, descriptorId js.String) js.Ref
  2836  
  2837  func (fn OnDescriptorWriteRequestEventCallbackFunc) Register() js.Func[func(request *Request, descriptorId js.String)] {
  2838  	return js.RegisterCallback[func(request *Request, descriptorId js.String)](
  2839  		fn, abi.FuncPCABIInternal(fn),
  2840  	)
  2841  }
  2842  
  2843  func (fn OnDescriptorWriteRequestEventCallbackFunc) DispatchCallback(
  2844  	targetPC uintptr, ctx *js.CallbackContext,
  2845  ) {
  2846  	args := ctx.Args()
  2847  	if len(args) != 2+1 /* js this */ ||
  2848  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2849  		js.ThrowInvalidCallbackInvocation()
  2850  	}
  2851  	var arg0 Request
  2852  	arg0.UpdateFrom(args[0+1])
  2853  	defer arg0.FreeMembers(true)
  2854  
  2855  	if ctx.Return(fn(
  2856  		args[0],
  2857  
  2858  		mark.NoEscape(&arg0),
  2859  		js.String{}.FromRef(args[1+1]),
  2860  	)) {
  2861  		return
  2862  	}
  2863  
  2864  	js.ThrowCallbackValueNotReturned()
  2865  }
  2866  
  2867  type OnDescriptorWriteRequestEventCallback[T any] struct {
  2868  	Fn  func(arg T, this js.Ref, request *Request, descriptorId js.String) js.Ref
  2869  	Arg T
  2870  }
  2871  
  2872  func (cb *OnDescriptorWriteRequestEventCallback[T]) Register() js.Func[func(request *Request, descriptorId js.String)] {
  2873  	return js.RegisterCallback[func(request *Request, descriptorId js.String)](
  2874  		cb, abi.FuncPCABIInternal(cb.Fn),
  2875  	)
  2876  }
  2877  
  2878  func (cb *OnDescriptorWriteRequestEventCallback[T]) DispatchCallback(
  2879  	targetPC uintptr, ctx *js.CallbackContext,
  2880  ) {
  2881  	args := ctx.Args()
  2882  	if len(args) != 2+1 /* js this */ ||
  2883  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2884  		js.ThrowInvalidCallbackInvocation()
  2885  	}
  2886  	var arg0 Request
  2887  	arg0.UpdateFrom(args[0+1])
  2888  	defer arg0.FreeMembers(true)
  2889  
  2890  	if ctx.Return(cb.Fn(
  2891  		cb.Arg,
  2892  		args[0],
  2893  
  2894  		mark.NoEscape(&arg0),
  2895  		js.String{}.FromRef(args[1+1]),
  2896  	)) {
  2897  		return
  2898  	}
  2899  
  2900  	js.ThrowCallbackValueNotReturned()
  2901  }
  2902  
  2903  // HasFuncOnDescriptorWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.addListener" exists.
  2904  func HasFuncOnDescriptorWriteRequest() bool {
  2905  	return js.True == bindings.HasFuncOnDescriptorWriteRequest()
  2906  }
  2907  
  2908  // FuncOnDescriptorWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.addListener".
  2909  func FuncOnDescriptorWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)])]) {
  2910  	bindings.FuncOnDescriptorWriteRequest(
  2911  		js.Pointer(&fn),
  2912  	)
  2913  	return
  2914  }
  2915  
  2916  // OnDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.addListener" directly.
  2917  func OnDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void) {
  2918  	bindings.CallOnDescriptorWriteRequest(
  2919  		js.Pointer(&ret),
  2920  		callback.Ref(),
  2921  	)
  2922  
  2923  	return
  2924  }
  2925  
  2926  // TryOnDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.addListener"
  2927  // in a try/catch block and returns (_, err, ok = false) when it went through
  2928  // the catch clause.
  2929  func TryOnDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2930  	ok = js.True == bindings.TryOnDescriptorWriteRequest(
  2931  		js.Pointer(&ret), js.Pointer(&exception),
  2932  		callback.Ref(),
  2933  	)
  2934  
  2935  	return
  2936  }
  2937  
  2938  // HasFuncOffDescriptorWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.removeListener" exists.
  2939  func HasFuncOffDescriptorWriteRequest() bool {
  2940  	return js.True == bindings.HasFuncOffDescriptorWriteRequest()
  2941  }
  2942  
  2943  // FuncOffDescriptorWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.removeListener".
  2944  func FuncOffDescriptorWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)])]) {
  2945  	bindings.FuncOffDescriptorWriteRequest(
  2946  		js.Pointer(&fn),
  2947  	)
  2948  	return
  2949  }
  2950  
  2951  // OffDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.removeListener" directly.
  2952  func OffDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void) {
  2953  	bindings.CallOffDescriptorWriteRequest(
  2954  		js.Pointer(&ret),
  2955  		callback.Ref(),
  2956  	)
  2957  
  2958  	return
  2959  }
  2960  
  2961  // TryOffDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.removeListener"
  2962  // in a try/catch block and returns (_, err, ok = false) when it went through
  2963  // the catch clause.
  2964  func TryOffDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret js.Void, exception js.Any, ok bool) {
  2965  	ok = js.True == bindings.TryOffDescriptorWriteRequest(
  2966  		js.Pointer(&ret), js.Pointer(&exception),
  2967  		callback.Ref(),
  2968  	)
  2969  
  2970  	return
  2971  }
  2972  
  2973  // HasFuncHasOnDescriptorWriteRequest returns true if the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.hasListener" exists.
  2974  func HasFuncHasOnDescriptorWriteRequest() bool {
  2975  	return js.True == bindings.HasFuncHasOnDescriptorWriteRequest()
  2976  }
  2977  
  2978  // FuncHasOnDescriptorWriteRequest returns the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.hasListener".
  2979  func FuncHasOnDescriptorWriteRequest() (fn js.Func[func(callback js.Func[func(request *Request, descriptorId js.String)]) bool]) {
  2980  	bindings.FuncHasOnDescriptorWriteRequest(
  2981  		js.Pointer(&fn),
  2982  	)
  2983  	return
  2984  }
  2985  
  2986  // HasOnDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.hasListener" directly.
  2987  func HasOnDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret bool) {
  2988  	bindings.CallHasOnDescriptorWriteRequest(
  2989  		js.Pointer(&ret),
  2990  		callback.Ref(),
  2991  	)
  2992  
  2993  	return
  2994  }
  2995  
  2996  // TryHasOnDescriptorWriteRequest calls the function "WEBEXT.bluetoothLowEnergy.onDescriptorWriteRequest.hasListener"
  2997  // in a try/catch block and returns (_, err, ok = false) when it went through
  2998  // the catch clause.
  2999  func TryHasOnDescriptorWriteRequest(callback js.Func[func(request *Request, descriptorId js.String)]) (ret bool, exception js.Any, ok bool) {
  3000  	ok = js.True == bindings.TryHasOnDescriptorWriteRequest(
  3001  		js.Pointer(&ret), js.Pointer(&exception),
  3002  		callback.Ref(),
  3003  	)
  3004  
  3005  	return
  3006  }
  3007  
  3008  type OnServiceAddedEventCallbackFunc func(this js.Ref, service *Service) js.Ref
  3009  
  3010  func (fn OnServiceAddedEventCallbackFunc) Register() js.Func[func(service *Service)] {
  3011  	return js.RegisterCallback[func(service *Service)](
  3012  		fn, abi.FuncPCABIInternal(fn),
  3013  	)
  3014  }
  3015  
  3016  func (fn OnServiceAddedEventCallbackFunc) DispatchCallback(
  3017  	targetPC uintptr, ctx *js.CallbackContext,
  3018  ) {
  3019  	args := ctx.Args()
  3020  	if len(args) != 1+1 /* js this */ ||
  3021  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  3022  		js.ThrowInvalidCallbackInvocation()
  3023  	}
  3024  	var arg0 Service
  3025  	arg0.UpdateFrom(args[0+1])
  3026  	defer arg0.FreeMembers(true)
  3027  
  3028  	if ctx.Return(fn(
  3029  		args[0],
  3030  
  3031  		mark.NoEscape(&arg0),
  3032  	)) {
  3033  		return
  3034  	}
  3035  
  3036  	js.ThrowCallbackValueNotReturned()
  3037  }
  3038  
  3039  type OnServiceAddedEventCallback[T any] struct {
  3040  	Fn  func(arg T, this js.Ref, service *Service) js.Ref
  3041  	Arg T
  3042  }
  3043  
  3044  func (cb *OnServiceAddedEventCallback[T]) Register() js.Func[func(service *Service)] {
  3045  	return js.RegisterCallback[func(service *Service)](
  3046  		cb, abi.FuncPCABIInternal(cb.Fn),
  3047  	)
  3048  }
  3049  
  3050  func (cb *OnServiceAddedEventCallback[T]) DispatchCallback(
  3051  	targetPC uintptr, ctx *js.CallbackContext,
  3052  ) {
  3053  	args := ctx.Args()
  3054  	if len(args) != 1+1 /* js this */ ||
  3055  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  3056  		js.ThrowInvalidCallbackInvocation()
  3057  	}
  3058  	var arg0 Service
  3059  	arg0.UpdateFrom(args[0+1])
  3060  	defer arg0.FreeMembers(true)
  3061  
  3062  	if ctx.Return(cb.Fn(
  3063  		cb.Arg,
  3064  		args[0],
  3065  
  3066  		mark.NoEscape(&arg0),
  3067  	)) {
  3068  		return
  3069  	}
  3070  
  3071  	js.ThrowCallbackValueNotReturned()
  3072  }
  3073  
  3074  // HasFuncOnServiceAdded returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.addListener" exists.
  3075  func HasFuncOnServiceAdded() bool {
  3076  	return js.True == bindings.HasFuncOnServiceAdded()
  3077  }
  3078  
  3079  // FuncOnServiceAdded returns the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.addListener".
  3080  func FuncOnServiceAdded() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3081  	bindings.FuncOnServiceAdded(
  3082  		js.Pointer(&fn),
  3083  	)
  3084  	return
  3085  }
  3086  
  3087  // OnServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.addListener" directly.
  3088  func OnServiceAdded(callback js.Func[func(service *Service)]) (ret js.Void) {
  3089  	bindings.CallOnServiceAdded(
  3090  		js.Pointer(&ret),
  3091  		callback.Ref(),
  3092  	)
  3093  
  3094  	return
  3095  }
  3096  
  3097  // TryOnServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.addListener"
  3098  // in a try/catch block and returns (_, err, ok = false) when it went through
  3099  // the catch clause.
  3100  func TryOnServiceAdded(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3101  	ok = js.True == bindings.TryOnServiceAdded(
  3102  		js.Pointer(&ret), js.Pointer(&exception),
  3103  		callback.Ref(),
  3104  	)
  3105  
  3106  	return
  3107  }
  3108  
  3109  // HasFuncOffServiceAdded returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.removeListener" exists.
  3110  func HasFuncOffServiceAdded() bool {
  3111  	return js.True == bindings.HasFuncOffServiceAdded()
  3112  }
  3113  
  3114  // FuncOffServiceAdded returns the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.removeListener".
  3115  func FuncOffServiceAdded() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3116  	bindings.FuncOffServiceAdded(
  3117  		js.Pointer(&fn),
  3118  	)
  3119  	return
  3120  }
  3121  
  3122  // OffServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.removeListener" directly.
  3123  func OffServiceAdded(callback js.Func[func(service *Service)]) (ret js.Void) {
  3124  	bindings.CallOffServiceAdded(
  3125  		js.Pointer(&ret),
  3126  		callback.Ref(),
  3127  	)
  3128  
  3129  	return
  3130  }
  3131  
  3132  // TryOffServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.removeListener"
  3133  // in a try/catch block and returns (_, err, ok = false) when it went through
  3134  // the catch clause.
  3135  func TryOffServiceAdded(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3136  	ok = js.True == bindings.TryOffServiceAdded(
  3137  		js.Pointer(&ret), js.Pointer(&exception),
  3138  		callback.Ref(),
  3139  	)
  3140  
  3141  	return
  3142  }
  3143  
  3144  // HasFuncHasOnServiceAdded returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.hasListener" exists.
  3145  func HasFuncHasOnServiceAdded() bool {
  3146  	return js.True == bindings.HasFuncHasOnServiceAdded()
  3147  }
  3148  
  3149  // FuncHasOnServiceAdded returns the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.hasListener".
  3150  func FuncHasOnServiceAdded() (fn js.Func[func(callback js.Func[func(service *Service)]) bool]) {
  3151  	bindings.FuncHasOnServiceAdded(
  3152  		js.Pointer(&fn),
  3153  	)
  3154  	return
  3155  }
  3156  
  3157  // HasOnServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.hasListener" directly.
  3158  func HasOnServiceAdded(callback js.Func[func(service *Service)]) (ret bool) {
  3159  	bindings.CallHasOnServiceAdded(
  3160  		js.Pointer(&ret),
  3161  		callback.Ref(),
  3162  	)
  3163  
  3164  	return
  3165  }
  3166  
  3167  // TryHasOnServiceAdded calls the function "WEBEXT.bluetoothLowEnergy.onServiceAdded.hasListener"
  3168  // in a try/catch block and returns (_, err, ok = false) when it went through
  3169  // the catch clause.
  3170  func TryHasOnServiceAdded(callback js.Func[func(service *Service)]) (ret bool, exception js.Any, ok bool) {
  3171  	ok = js.True == bindings.TryHasOnServiceAdded(
  3172  		js.Pointer(&ret), js.Pointer(&exception),
  3173  		callback.Ref(),
  3174  	)
  3175  
  3176  	return
  3177  }
  3178  
  3179  type OnServiceChangedEventCallbackFunc func(this js.Ref, service *Service) js.Ref
  3180  
  3181  func (fn OnServiceChangedEventCallbackFunc) Register() js.Func[func(service *Service)] {
  3182  	return js.RegisterCallback[func(service *Service)](
  3183  		fn, abi.FuncPCABIInternal(fn),
  3184  	)
  3185  }
  3186  
  3187  func (fn OnServiceChangedEventCallbackFunc) DispatchCallback(
  3188  	targetPC uintptr, ctx *js.CallbackContext,
  3189  ) {
  3190  	args := ctx.Args()
  3191  	if len(args) != 1+1 /* js this */ ||
  3192  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  3193  		js.ThrowInvalidCallbackInvocation()
  3194  	}
  3195  	var arg0 Service
  3196  	arg0.UpdateFrom(args[0+1])
  3197  	defer arg0.FreeMembers(true)
  3198  
  3199  	if ctx.Return(fn(
  3200  		args[0],
  3201  
  3202  		mark.NoEscape(&arg0),
  3203  	)) {
  3204  		return
  3205  	}
  3206  
  3207  	js.ThrowCallbackValueNotReturned()
  3208  }
  3209  
  3210  type OnServiceChangedEventCallback[T any] struct {
  3211  	Fn  func(arg T, this js.Ref, service *Service) js.Ref
  3212  	Arg T
  3213  }
  3214  
  3215  func (cb *OnServiceChangedEventCallback[T]) Register() js.Func[func(service *Service)] {
  3216  	return js.RegisterCallback[func(service *Service)](
  3217  		cb, abi.FuncPCABIInternal(cb.Fn),
  3218  	)
  3219  }
  3220  
  3221  func (cb *OnServiceChangedEventCallback[T]) DispatchCallback(
  3222  	targetPC uintptr, ctx *js.CallbackContext,
  3223  ) {
  3224  	args := ctx.Args()
  3225  	if len(args) != 1+1 /* js this */ ||
  3226  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  3227  		js.ThrowInvalidCallbackInvocation()
  3228  	}
  3229  	var arg0 Service
  3230  	arg0.UpdateFrom(args[0+1])
  3231  	defer arg0.FreeMembers(true)
  3232  
  3233  	if ctx.Return(cb.Fn(
  3234  		cb.Arg,
  3235  		args[0],
  3236  
  3237  		mark.NoEscape(&arg0),
  3238  	)) {
  3239  		return
  3240  	}
  3241  
  3242  	js.ThrowCallbackValueNotReturned()
  3243  }
  3244  
  3245  // HasFuncOnServiceChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.addListener" exists.
  3246  func HasFuncOnServiceChanged() bool {
  3247  	return js.True == bindings.HasFuncOnServiceChanged()
  3248  }
  3249  
  3250  // FuncOnServiceChanged returns the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.addListener".
  3251  func FuncOnServiceChanged() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3252  	bindings.FuncOnServiceChanged(
  3253  		js.Pointer(&fn),
  3254  	)
  3255  	return
  3256  }
  3257  
  3258  // OnServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.addListener" directly.
  3259  func OnServiceChanged(callback js.Func[func(service *Service)]) (ret js.Void) {
  3260  	bindings.CallOnServiceChanged(
  3261  		js.Pointer(&ret),
  3262  		callback.Ref(),
  3263  	)
  3264  
  3265  	return
  3266  }
  3267  
  3268  // TryOnServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.addListener"
  3269  // in a try/catch block and returns (_, err, ok = false) when it went through
  3270  // the catch clause.
  3271  func TryOnServiceChanged(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3272  	ok = js.True == bindings.TryOnServiceChanged(
  3273  		js.Pointer(&ret), js.Pointer(&exception),
  3274  		callback.Ref(),
  3275  	)
  3276  
  3277  	return
  3278  }
  3279  
  3280  // HasFuncOffServiceChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.removeListener" exists.
  3281  func HasFuncOffServiceChanged() bool {
  3282  	return js.True == bindings.HasFuncOffServiceChanged()
  3283  }
  3284  
  3285  // FuncOffServiceChanged returns the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.removeListener".
  3286  func FuncOffServiceChanged() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3287  	bindings.FuncOffServiceChanged(
  3288  		js.Pointer(&fn),
  3289  	)
  3290  	return
  3291  }
  3292  
  3293  // OffServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.removeListener" directly.
  3294  func OffServiceChanged(callback js.Func[func(service *Service)]) (ret js.Void) {
  3295  	bindings.CallOffServiceChanged(
  3296  		js.Pointer(&ret),
  3297  		callback.Ref(),
  3298  	)
  3299  
  3300  	return
  3301  }
  3302  
  3303  // TryOffServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.removeListener"
  3304  // in a try/catch block and returns (_, err, ok = false) when it went through
  3305  // the catch clause.
  3306  func TryOffServiceChanged(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3307  	ok = js.True == bindings.TryOffServiceChanged(
  3308  		js.Pointer(&ret), js.Pointer(&exception),
  3309  		callback.Ref(),
  3310  	)
  3311  
  3312  	return
  3313  }
  3314  
  3315  // HasFuncHasOnServiceChanged returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.hasListener" exists.
  3316  func HasFuncHasOnServiceChanged() bool {
  3317  	return js.True == bindings.HasFuncHasOnServiceChanged()
  3318  }
  3319  
  3320  // FuncHasOnServiceChanged returns the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.hasListener".
  3321  func FuncHasOnServiceChanged() (fn js.Func[func(callback js.Func[func(service *Service)]) bool]) {
  3322  	bindings.FuncHasOnServiceChanged(
  3323  		js.Pointer(&fn),
  3324  	)
  3325  	return
  3326  }
  3327  
  3328  // HasOnServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.hasListener" directly.
  3329  func HasOnServiceChanged(callback js.Func[func(service *Service)]) (ret bool) {
  3330  	bindings.CallHasOnServiceChanged(
  3331  		js.Pointer(&ret),
  3332  		callback.Ref(),
  3333  	)
  3334  
  3335  	return
  3336  }
  3337  
  3338  // TryHasOnServiceChanged calls the function "WEBEXT.bluetoothLowEnergy.onServiceChanged.hasListener"
  3339  // in a try/catch block and returns (_, err, ok = false) when it went through
  3340  // the catch clause.
  3341  func TryHasOnServiceChanged(callback js.Func[func(service *Service)]) (ret bool, exception js.Any, ok bool) {
  3342  	ok = js.True == bindings.TryHasOnServiceChanged(
  3343  		js.Pointer(&ret), js.Pointer(&exception),
  3344  		callback.Ref(),
  3345  	)
  3346  
  3347  	return
  3348  }
  3349  
  3350  type OnServiceRemovedEventCallbackFunc func(this js.Ref, service *Service) js.Ref
  3351  
  3352  func (fn OnServiceRemovedEventCallbackFunc) Register() js.Func[func(service *Service)] {
  3353  	return js.RegisterCallback[func(service *Service)](
  3354  		fn, abi.FuncPCABIInternal(fn),
  3355  	)
  3356  }
  3357  
  3358  func (fn OnServiceRemovedEventCallbackFunc) DispatchCallback(
  3359  	targetPC uintptr, ctx *js.CallbackContext,
  3360  ) {
  3361  	args := ctx.Args()
  3362  	if len(args) != 1+1 /* js this */ ||
  3363  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  3364  		js.ThrowInvalidCallbackInvocation()
  3365  	}
  3366  	var arg0 Service
  3367  	arg0.UpdateFrom(args[0+1])
  3368  	defer arg0.FreeMembers(true)
  3369  
  3370  	if ctx.Return(fn(
  3371  		args[0],
  3372  
  3373  		mark.NoEscape(&arg0),
  3374  	)) {
  3375  		return
  3376  	}
  3377  
  3378  	js.ThrowCallbackValueNotReturned()
  3379  }
  3380  
  3381  type OnServiceRemovedEventCallback[T any] struct {
  3382  	Fn  func(arg T, this js.Ref, service *Service) js.Ref
  3383  	Arg T
  3384  }
  3385  
  3386  func (cb *OnServiceRemovedEventCallback[T]) Register() js.Func[func(service *Service)] {
  3387  	return js.RegisterCallback[func(service *Service)](
  3388  		cb, abi.FuncPCABIInternal(cb.Fn),
  3389  	)
  3390  }
  3391  
  3392  func (cb *OnServiceRemovedEventCallback[T]) DispatchCallback(
  3393  	targetPC uintptr, ctx *js.CallbackContext,
  3394  ) {
  3395  	args := ctx.Args()
  3396  	if len(args) != 1+1 /* js this */ ||
  3397  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  3398  		js.ThrowInvalidCallbackInvocation()
  3399  	}
  3400  	var arg0 Service
  3401  	arg0.UpdateFrom(args[0+1])
  3402  	defer arg0.FreeMembers(true)
  3403  
  3404  	if ctx.Return(cb.Fn(
  3405  		cb.Arg,
  3406  		args[0],
  3407  
  3408  		mark.NoEscape(&arg0),
  3409  	)) {
  3410  		return
  3411  	}
  3412  
  3413  	js.ThrowCallbackValueNotReturned()
  3414  }
  3415  
  3416  // HasFuncOnServiceRemoved returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.addListener" exists.
  3417  func HasFuncOnServiceRemoved() bool {
  3418  	return js.True == bindings.HasFuncOnServiceRemoved()
  3419  }
  3420  
  3421  // FuncOnServiceRemoved returns the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.addListener".
  3422  func FuncOnServiceRemoved() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3423  	bindings.FuncOnServiceRemoved(
  3424  		js.Pointer(&fn),
  3425  	)
  3426  	return
  3427  }
  3428  
  3429  // OnServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.addListener" directly.
  3430  func OnServiceRemoved(callback js.Func[func(service *Service)]) (ret js.Void) {
  3431  	bindings.CallOnServiceRemoved(
  3432  		js.Pointer(&ret),
  3433  		callback.Ref(),
  3434  	)
  3435  
  3436  	return
  3437  }
  3438  
  3439  // TryOnServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.addListener"
  3440  // in a try/catch block and returns (_, err, ok = false) when it went through
  3441  // the catch clause.
  3442  func TryOnServiceRemoved(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3443  	ok = js.True == bindings.TryOnServiceRemoved(
  3444  		js.Pointer(&ret), js.Pointer(&exception),
  3445  		callback.Ref(),
  3446  	)
  3447  
  3448  	return
  3449  }
  3450  
  3451  // HasFuncOffServiceRemoved returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.removeListener" exists.
  3452  func HasFuncOffServiceRemoved() bool {
  3453  	return js.True == bindings.HasFuncOffServiceRemoved()
  3454  }
  3455  
  3456  // FuncOffServiceRemoved returns the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.removeListener".
  3457  func FuncOffServiceRemoved() (fn js.Func[func(callback js.Func[func(service *Service)])]) {
  3458  	bindings.FuncOffServiceRemoved(
  3459  		js.Pointer(&fn),
  3460  	)
  3461  	return
  3462  }
  3463  
  3464  // OffServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.removeListener" directly.
  3465  func OffServiceRemoved(callback js.Func[func(service *Service)]) (ret js.Void) {
  3466  	bindings.CallOffServiceRemoved(
  3467  		js.Pointer(&ret),
  3468  		callback.Ref(),
  3469  	)
  3470  
  3471  	return
  3472  }
  3473  
  3474  // TryOffServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.removeListener"
  3475  // in a try/catch block and returns (_, err, ok = false) when it went through
  3476  // the catch clause.
  3477  func TryOffServiceRemoved(callback js.Func[func(service *Service)]) (ret js.Void, exception js.Any, ok bool) {
  3478  	ok = js.True == bindings.TryOffServiceRemoved(
  3479  		js.Pointer(&ret), js.Pointer(&exception),
  3480  		callback.Ref(),
  3481  	)
  3482  
  3483  	return
  3484  }
  3485  
  3486  // HasFuncHasOnServiceRemoved returns true if the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.hasListener" exists.
  3487  func HasFuncHasOnServiceRemoved() bool {
  3488  	return js.True == bindings.HasFuncHasOnServiceRemoved()
  3489  }
  3490  
  3491  // FuncHasOnServiceRemoved returns the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.hasListener".
  3492  func FuncHasOnServiceRemoved() (fn js.Func[func(callback js.Func[func(service *Service)]) bool]) {
  3493  	bindings.FuncHasOnServiceRemoved(
  3494  		js.Pointer(&fn),
  3495  	)
  3496  	return
  3497  }
  3498  
  3499  // HasOnServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.hasListener" directly.
  3500  func HasOnServiceRemoved(callback js.Func[func(service *Service)]) (ret bool) {
  3501  	bindings.CallHasOnServiceRemoved(
  3502  		js.Pointer(&ret),
  3503  		callback.Ref(),
  3504  	)
  3505  
  3506  	return
  3507  }
  3508  
  3509  // TryHasOnServiceRemoved calls the function "WEBEXT.bluetoothLowEnergy.onServiceRemoved.hasListener"
  3510  // in a try/catch block and returns (_, err, ok = false) when it went through
  3511  // the catch clause.
  3512  func TryHasOnServiceRemoved(callback js.Func[func(service *Service)]) (ret bool, exception js.Any, ok bool) {
  3513  	ok = js.True == bindings.TryHasOnServiceRemoved(
  3514  		js.Pointer(&ret), js.Pointer(&exception),
  3515  		callback.Ref(),
  3516  	)
  3517  
  3518  	return
  3519  }
  3520  
  3521  // HasFuncReadCharacteristicValue returns true if the function "WEBEXT.bluetoothLowEnergy.readCharacteristicValue" exists.
  3522  func HasFuncReadCharacteristicValue() bool {
  3523  	return js.True == bindings.HasFuncReadCharacteristicValue()
  3524  }
  3525  
  3526  // FuncReadCharacteristicValue returns the function "WEBEXT.bluetoothLowEnergy.readCharacteristicValue".
  3527  func FuncReadCharacteristicValue() (fn js.Func[func(characteristicId js.String) js.Promise[Characteristic]]) {
  3528  	bindings.FuncReadCharacteristicValue(
  3529  		js.Pointer(&fn),
  3530  	)
  3531  	return
  3532  }
  3533  
  3534  // ReadCharacteristicValue calls the function "WEBEXT.bluetoothLowEnergy.readCharacteristicValue" directly.
  3535  func ReadCharacteristicValue(characteristicId js.String) (ret js.Promise[Characteristic]) {
  3536  	bindings.CallReadCharacteristicValue(
  3537  		js.Pointer(&ret),
  3538  		characteristicId.Ref(),
  3539  	)
  3540  
  3541  	return
  3542  }
  3543  
  3544  // TryReadCharacteristicValue calls the function "WEBEXT.bluetoothLowEnergy.readCharacteristicValue"
  3545  // in a try/catch block and returns (_, err, ok = false) when it went through
  3546  // the catch clause.
  3547  func TryReadCharacteristicValue(characteristicId js.String) (ret js.Promise[Characteristic], exception js.Any, ok bool) {
  3548  	ok = js.True == bindings.TryReadCharacteristicValue(
  3549  		js.Pointer(&ret), js.Pointer(&exception),
  3550  		characteristicId.Ref(),
  3551  	)
  3552  
  3553  	return
  3554  }
  3555  
  3556  // HasFuncReadDescriptorValue returns true if the function "WEBEXT.bluetoothLowEnergy.readDescriptorValue" exists.
  3557  func HasFuncReadDescriptorValue() bool {
  3558  	return js.True == bindings.HasFuncReadDescriptorValue()
  3559  }
  3560  
  3561  // FuncReadDescriptorValue returns the function "WEBEXT.bluetoothLowEnergy.readDescriptorValue".
  3562  func FuncReadDescriptorValue() (fn js.Func[func(descriptorId js.String) js.Promise[Descriptor]]) {
  3563  	bindings.FuncReadDescriptorValue(
  3564  		js.Pointer(&fn),
  3565  	)
  3566  	return
  3567  }
  3568  
  3569  // ReadDescriptorValue calls the function "WEBEXT.bluetoothLowEnergy.readDescriptorValue" directly.
  3570  func ReadDescriptorValue(descriptorId js.String) (ret js.Promise[Descriptor]) {
  3571  	bindings.CallReadDescriptorValue(
  3572  		js.Pointer(&ret),
  3573  		descriptorId.Ref(),
  3574  	)
  3575  
  3576  	return
  3577  }
  3578  
  3579  // TryReadDescriptorValue calls the function "WEBEXT.bluetoothLowEnergy.readDescriptorValue"
  3580  // in a try/catch block and returns (_, err, ok = false) when it went through
  3581  // the catch clause.
  3582  func TryReadDescriptorValue(descriptorId js.String) (ret js.Promise[Descriptor], exception js.Any, ok bool) {
  3583  	ok = js.True == bindings.TryReadDescriptorValue(
  3584  		js.Pointer(&ret), js.Pointer(&exception),
  3585  		descriptorId.Ref(),
  3586  	)
  3587  
  3588  	return
  3589  }
  3590  
  3591  // HasFuncRegisterAdvertisement returns true if the function "WEBEXT.bluetoothLowEnergy.registerAdvertisement" exists.
  3592  func HasFuncRegisterAdvertisement() bool {
  3593  	return js.True == bindings.HasFuncRegisterAdvertisement()
  3594  }
  3595  
  3596  // FuncRegisterAdvertisement returns the function "WEBEXT.bluetoothLowEnergy.registerAdvertisement".
  3597  func FuncRegisterAdvertisement() (fn js.Func[func(advertisement Advertisement) js.Promise[js.Number[int32]]]) {
  3598  	bindings.FuncRegisterAdvertisement(
  3599  		js.Pointer(&fn),
  3600  	)
  3601  	return
  3602  }
  3603  
  3604  // RegisterAdvertisement calls the function "WEBEXT.bluetoothLowEnergy.registerAdvertisement" directly.
  3605  func RegisterAdvertisement(advertisement Advertisement) (ret js.Promise[js.Number[int32]]) {
  3606  	bindings.CallRegisterAdvertisement(
  3607  		js.Pointer(&ret),
  3608  		js.Pointer(&advertisement),
  3609  	)
  3610  
  3611  	return
  3612  }
  3613  
  3614  // TryRegisterAdvertisement calls the function "WEBEXT.bluetoothLowEnergy.registerAdvertisement"
  3615  // in a try/catch block and returns (_, err, ok = false) when it went through
  3616  // the catch clause.
  3617  func TryRegisterAdvertisement(advertisement Advertisement) (ret js.Promise[js.Number[int32]], exception js.Any, ok bool) {
  3618  	ok = js.True == bindings.TryRegisterAdvertisement(
  3619  		js.Pointer(&ret), js.Pointer(&exception),
  3620  		js.Pointer(&advertisement),
  3621  	)
  3622  
  3623  	return
  3624  }
  3625  
  3626  // HasFuncRegisterService returns true if the function "WEBEXT.bluetoothLowEnergy.registerService" exists.
  3627  func HasFuncRegisterService() bool {
  3628  	return js.True == bindings.HasFuncRegisterService()
  3629  }
  3630  
  3631  // FuncRegisterService returns the function "WEBEXT.bluetoothLowEnergy.registerService".
  3632  func FuncRegisterService() (fn js.Func[func(serviceId js.String) js.Promise[js.Void]]) {
  3633  	bindings.FuncRegisterService(
  3634  		js.Pointer(&fn),
  3635  	)
  3636  	return
  3637  }
  3638  
  3639  // RegisterService calls the function "WEBEXT.bluetoothLowEnergy.registerService" directly.
  3640  func RegisterService(serviceId js.String) (ret js.Promise[js.Void]) {
  3641  	bindings.CallRegisterService(
  3642  		js.Pointer(&ret),
  3643  		serviceId.Ref(),
  3644  	)
  3645  
  3646  	return
  3647  }
  3648  
  3649  // TryRegisterService calls the function "WEBEXT.bluetoothLowEnergy.registerService"
  3650  // in a try/catch block and returns (_, err, ok = false) when it went through
  3651  // the catch clause.
  3652  func TryRegisterService(serviceId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3653  	ok = js.True == bindings.TryRegisterService(
  3654  		js.Pointer(&ret), js.Pointer(&exception),
  3655  		serviceId.Ref(),
  3656  	)
  3657  
  3658  	return
  3659  }
  3660  
  3661  // HasFuncRemoveService returns true if the function "WEBEXT.bluetoothLowEnergy.removeService" exists.
  3662  func HasFuncRemoveService() bool {
  3663  	return js.True == bindings.HasFuncRemoveService()
  3664  }
  3665  
  3666  // FuncRemoveService returns the function "WEBEXT.bluetoothLowEnergy.removeService".
  3667  func FuncRemoveService() (fn js.Func[func(serviceId js.String) js.Promise[js.Void]]) {
  3668  	bindings.FuncRemoveService(
  3669  		js.Pointer(&fn),
  3670  	)
  3671  	return
  3672  }
  3673  
  3674  // RemoveService calls the function "WEBEXT.bluetoothLowEnergy.removeService" directly.
  3675  func RemoveService(serviceId js.String) (ret js.Promise[js.Void]) {
  3676  	bindings.CallRemoveService(
  3677  		js.Pointer(&ret),
  3678  		serviceId.Ref(),
  3679  	)
  3680  
  3681  	return
  3682  }
  3683  
  3684  // TryRemoveService calls the function "WEBEXT.bluetoothLowEnergy.removeService"
  3685  // in a try/catch block and returns (_, err, ok = false) when it went through
  3686  // the catch clause.
  3687  func TryRemoveService(serviceId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3688  	ok = js.True == bindings.TryRemoveService(
  3689  		js.Pointer(&ret), js.Pointer(&exception),
  3690  		serviceId.Ref(),
  3691  	)
  3692  
  3693  	return
  3694  }
  3695  
  3696  // HasFuncResetAdvertising returns true if the function "WEBEXT.bluetoothLowEnergy.resetAdvertising" exists.
  3697  func HasFuncResetAdvertising() bool {
  3698  	return js.True == bindings.HasFuncResetAdvertising()
  3699  }
  3700  
  3701  // FuncResetAdvertising returns the function "WEBEXT.bluetoothLowEnergy.resetAdvertising".
  3702  func FuncResetAdvertising() (fn js.Func[func() js.Promise[js.Void]]) {
  3703  	bindings.FuncResetAdvertising(
  3704  		js.Pointer(&fn),
  3705  	)
  3706  	return
  3707  }
  3708  
  3709  // ResetAdvertising calls the function "WEBEXT.bluetoothLowEnergy.resetAdvertising" directly.
  3710  func ResetAdvertising() (ret js.Promise[js.Void]) {
  3711  	bindings.CallResetAdvertising(
  3712  		js.Pointer(&ret),
  3713  	)
  3714  
  3715  	return
  3716  }
  3717  
  3718  // TryResetAdvertising calls the function "WEBEXT.bluetoothLowEnergy.resetAdvertising"
  3719  // in a try/catch block and returns (_, err, ok = false) when it went through
  3720  // the catch clause.
  3721  func TryResetAdvertising() (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3722  	ok = js.True == bindings.TryResetAdvertising(
  3723  		js.Pointer(&ret), js.Pointer(&exception),
  3724  	)
  3725  
  3726  	return
  3727  }
  3728  
  3729  // HasFuncSendRequestResponse returns true if the function "WEBEXT.bluetoothLowEnergy.sendRequestResponse" exists.
  3730  func HasFuncSendRequestResponse() bool {
  3731  	return js.True == bindings.HasFuncSendRequestResponse()
  3732  }
  3733  
  3734  // FuncSendRequestResponse returns the function "WEBEXT.bluetoothLowEnergy.sendRequestResponse".
  3735  func FuncSendRequestResponse() (fn js.Func[func(response Response)]) {
  3736  	bindings.FuncSendRequestResponse(
  3737  		js.Pointer(&fn),
  3738  	)
  3739  	return
  3740  }
  3741  
  3742  // SendRequestResponse calls the function "WEBEXT.bluetoothLowEnergy.sendRequestResponse" directly.
  3743  func SendRequestResponse(response Response) (ret js.Void) {
  3744  	bindings.CallSendRequestResponse(
  3745  		js.Pointer(&ret),
  3746  		js.Pointer(&response),
  3747  	)
  3748  
  3749  	return
  3750  }
  3751  
  3752  // TrySendRequestResponse calls the function "WEBEXT.bluetoothLowEnergy.sendRequestResponse"
  3753  // in a try/catch block and returns (_, err, ok = false) when it went through
  3754  // the catch clause.
  3755  func TrySendRequestResponse(response Response) (ret js.Void, exception js.Any, ok bool) {
  3756  	ok = js.True == bindings.TrySendRequestResponse(
  3757  		js.Pointer(&ret), js.Pointer(&exception),
  3758  		js.Pointer(&response),
  3759  	)
  3760  
  3761  	return
  3762  }
  3763  
  3764  // HasFuncSetAdvertisingInterval returns true if the function "WEBEXT.bluetoothLowEnergy.setAdvertisingInterval" exists.
  3765  func HasFuncSetAdvertisingInterval() bool {
  3766  	return js.True == bindings.HasFuncSetAdvertisingInterval()
  3767  }
  3768  
  3769  // FuncSetAdvertisingInterval returns the function "WEBEXT.bluetoothLowEnergy.setAdvertisingInterval".
  3770  func FuncSetAdvertisingInterval() (fn js.Func[func(minInterval int32, maxInterval int32) js.Promise[js.Void]]) {
  3771  	bindings.FuncSetAdvertisingInterval(
  3772  		js.Pointer(&fn),
  3773  	)
  3774  	return
  3775  }
  3776  
  3777  // SetAdvertisingInterval calls the function "WEBEXT.bluetoothLowEnergy.setAdvertisingInterval" directly.
  3778  func SetAdvertisingInterval(minInterval int32, maxInterval int32) (ret js.Promise[js.Void]) {
  3779  	bindings.CallSetAdvertisingInterval(
  3780  		js.Pointer(&ret),
  3781  		int32(minInterval),
  3782  		int32(maxInterval),
  3783  	)
  3784  
  3785  	return
  3786  }
  3787  
  3788  // TrySetAdvertisingInterval calls the function "WEBEXT.bluetoothLowEnergy.setAdvertisingInterval"
  3789  // in a try/catch block and returns (_, err, ok = false) when it went through
  3790  // the catch clause.
  3791  func TrySetAdvertisingInterval(minInterval int32, maxInterval int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3792  	ok = js.True == bindings.TrySetAdvertisingInterval(
  3793  		js.Pointer(&ret), js.Pointer(&exception),
  3794  		int32(minInterval),
  3795  		int32(maxInterval),
  3796  	)
  3797  
  3798  	return
  3799  }
  3800  
  3801  // HasFuncStartCharacteristicNotifications returns true if the function "WEBEXT.bluetoothLowEnergy.startCharacteristicNotifications" exists.
  3802  func HasFuncStartCharacteristicNotifications() bool {
  3803  	return js.True == bindings.HasFuncStartCharacteristicNotifications()
  3804  }
  3805  
  3806  // FuncStartCharacteristicNotifications returns the function "WEBEXT.bluetoothLowEnergy.startCharacteristicNotifications".
  3807  func FuncStartCharacteristicNotifications() (fn js.Func[func(characteristicId js.String, properties NotificationProperties) js.Promise[js.Void]]) {
  3808  	bindings.FuncStartCharacteristicNotifications(
  3809  		js.Pointer(&fn),
  3810  	)
  3811  	return
  3812  }
  3813  
  3814  // StartCharacteristicNotifications calls the function "WEBEXT.bluetoothLowEnergy.startCharacteristicNotifications" directly.
  3815  func StartCharacteristicNotifications(characteristicId js.String, properties NotificationProperties) (ret js.Promise[js.Void]) {
  3816  	bindings.CallStartCharacteristicNotifications(
  3817  		js.Pointer(&ret),
  3818  		characteristicId.Ref(),
  3819  		js.Pointer(&properties),
  3820  	)
  3821  
  3822  	return
  3823  }
  3824  
  3825  // TryStartCharacteristicNotifications calls the function "WEBEXT.bluetoothLowEnergy.startCharacteristicNotifications"
  3826  // in a try/catch block and returns (_, err, ok = false) when it went through
  3827  // the catch clause.
  3828  func TryStartCharacteristicNotifications(characteristicId js.String, properties NotificationProperties) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3829  	ok = js.True == bindings.TryStartCharacteristicNotifications(
  3830  		js.Pointer(&ret), js.Pointer(&exception),
  3831  		characteristicId.Ref(),
  3832  		js.Pointer(&properties),
  3833  	)
  3834  
  3835  	return
  3836  }
  3837  
  3838  // HasFuncStopCharacteristicNotifications returns true if the function "WEBEXT.bluetoothLowEnergy.stopCharacteristicNotifications" exists.
  3839  func HasFuncStopCharacteristicNotifications() bool {
  3840  	return js.True == bindings.HasFuncStopCharacteristicNotifications()
  3841  }
  3842  
  3843  // FuncStopCharacteristicNotifications returns the function "WEBEXT.bluetoothLowEnergy.stopCharacteristicNotifications".
  3844  func FuncStopCharacteristicNotifications() (fn js.Func[func(characteristicId js.String) js.Promise[js.Void]]) {
  3845  	bindings.FuncStopCharacteristicNotifications(
  3846  		js.Pointer(&fn),
  3847  	)
  3848  	return
  3849  }
  3850  
  3851  // StopCharacteristicNotifications calls the function "WEBEXT.bluetoothLowEnergy.stopCharacteristicNotifications" directly.
  3852  func StopCharacteristicNotifications(characteristicId js.String) (ret js.Promise[js.Void]) {
  3853  	bindings.CallStopCharacteristicNotifications(
  3854  		js.Pointer(&ret),
  3855  		characteristicId.Ref(),
  3856  	)
  3857  
  3858  	return
  3859  }
  3860  
  3861  // TryStopCharacteristicNotifications calls the function "WEBEXT.bluetoothLowEnergy.stopCharacteristicNotifications"
  3862  // in a try/catch block and returns (_, err, ok = false) when it went through
  3863  // the catch clause.
  3864  func TryStopCharacteristicNotifications(characteristicId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3865  	ok = js.True == bindings.TryStopCharacteristicNotifications(
  3866  		js.Pointer(&ret), js.Pointer(&exception),
  3867  		characteristicId.Ref(),
  3868  	)
  3869  
  3870  	return
  3871  }
  3872  
  3873  // HasFuncUnregisterAdvertisement returns true if the function "WEBEXT.bluetoothLowEnergy.unregisterAdvertisement" exists.
  3874  func HasFuncUnregisterAdvertisement() bool {
  3875  	return js.True == bindings.HasFuncUnregisterAdvertisement()
  3876  }
  3877  
  3878  // FuncUnregisterAdvertisement returns the function "WEBEXT.bluetoothLowEnergy.unregisterAdvertisement".
  3879  func FuncUnregisterAdvertisement() (fn js.Func[func(advertisementId int32) js.Promise[js.Void]]) {
  3880  	bindings.FuncUnregisterAdvertisement(
  3881  		js.Pointer(&fn),
  3882  	)
  3883  	return
  3884  }
  3885  
  3886  // UnregisterAdvertisement calls the function "WEBEXT.bluetoothLowEnergy.unregisterAdvertisement" directly.
  3887  func UnregisterAdvertisement(advertisementId int32) (ret js.Promise[js.Void]) {
  3888  	bindings.CallUnregisterAdvertisement(
  3889  		js.Pointer(&ret),
  3890  		int32(advertisementId),
  3891  	)
  3892  
  3893  	return
  3894  }
  3895  
  3896  // TryUnregisterAdvertisement calls the function "WEBEXT.bluetoothLowEnergy.unregisterAdvertisement"
  3897  // in a try/catch block and returns (_, err, ok = false) when it went through
  3898  // the catch clause.
  3899  func TryUnregisterAdvertisement(advertisementId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3900  	ok = js.True == bindings.TryUnregisterAdvertisement(
  3901  		js.Pointer(&ret), js.Pointer(&exception),
  3902  		int32(advertisementId),
  3903  	)
  3904  
  3905  	return
  3906  }
  3907  
  3908  // HasFuncUnregisterService returns true if the function "WEBEXT.bluetoothLowEnergy.unregisterService" exists.
  3909  func HasFuncUnregisterService() bool {
  3910  	return js.True == bindings.HasFuncUnregisterService()
  3911  }
  3912  
  3913  // FuncUnregisterService returns the function "WEBEXT.bluetoothLowEnergy.unregisterService".
  3914  func FuncUnregisterService() (fn js.Func[func(serviceId js.String) js.Promise[js.Void]]) {
  3915  	bindings.FuncUnregisterService(
  3916  		js.Pointer(&fn),
  3917  	)
  3918  	return
  3919  }
  3920  
  3921  // UnregisterService calls the function "WEBEXT.bluetoothLowEnergy.unregisterService" directly.
  3922  func UnregisterService(serviceId js.String) (ret js.Promise[js.Void]) {
  3923  	bindings.CallUnregisterService(
  3924  		js.Pointer(&ret),
  3925  		serviceId.Ref(),
  3926  	)
  3927  
  3928  	return
  3929  }
  3930  
  3931  // TryUnregisterService calls the function "WEBEXT.bluetoothLowEnergy.unregisterService"
  3932  // in a try/catch block and returns (_, err, ok = false) when it went through
  3933  // the catch clause.
  3934  func TryUnregisterService(serviceId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3935  	ok = js.True == bindings.TryUnregisterService(
  3936  		js.Pointer(&ret), js.Pointer(&exception),
  3937  		serviceId.Ref(),
  3938  	)
  3939  
  3940  	return
  3941  }
  3942  
  3943  // HasFuncWriteCharacteristicValue returns true if the function "WEBEXT.bluetoothLowEnergy.writeCharacteristicValue" exists.
  3944  func HasFuncWriteCharacteristicValue() bool {
  3945  	return js.True == bindings.HasFuncWriteCharacteristicValue()
  3946  }
  3947  
  3948  // FuncWriteCharacteristicValue returns the function "WEBEXT.bluetoothLowEnergy.writeCharacteristicValue".
  3949  func FuncWriteCharacteristicValue() (fn js.Func[func(characteristicId js.String, value js.ArrayBuffer) js.Promise[js.Void]]) {
  3950  	bindings.FuncWriteCharacteristicValue(
  3951  		js.Pointer(&fn),
  3952  	)
  3953  	return
  3954  }
  3955  
  3956  // WriteCharacteristicValue calls the function "WEBEXT.bluetoothLowEnergy.writeCharacteristicValue" directly.
  3957  func WriteCharacteristicValue(characteristicId js.String, value js.ArrayBuffer) (ret js.Promise[js.Void]) {
  3958  	bindings.CallWriteCharacteristicValue(
  3959  		js.Pointer(&ret),
  3960  		characteristicId.Ref(),
  3961  		value.Ref(),
  3962  	)
  3963  
  3964  	return
  3965  }
  3966  
  3967  // TryWriteCharacteristicValue calls the function "WEBEXT.bluetoothLowEnergy.writeCharacteristicValue"
  3968  // in a try/catch block and returns (_, err, ok = false) when it went through
  3969  // the catch clause.
  3970  func TryWriteCharacteristicValue(characteristicId js.String, value js.ArrayBuffer) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  3971  	ok = js.True == bindings.TryWriteCharacteristicValue(
  3972  		js.Pointer(&ret), js.Pointer(&exception),
  3973  		characteristicId.Ref(),
  3974  		value.Ref(),
  3975  	)
  3976  
  3977  	return
  3978  }
  3979  
  3980  // HasFuncWriteDescriptorValue returns true if the function "WEBEXT.bluetoothLowEnergy.writeDescriptorValue" exists.
  3981  func HasFuncWriteDescriptorValue() bool {
  3982  	return js.True == bindings.HasFuncWriteDescriptorValue()
  3983  }
  3984  
  3985  // FuncWriteDescriptorValue returns the function "WEBEXT.bluetoothLowEnergy.writeDescriptorValue".
  3986  func FuncWriteDescriptorValue() (fn js.Func[func(descriptorId js.String, value js.ArrayBuffer) js.Promise[js.Void]]) {
  3987  	bindings.FuncWriteDescriptorValue(
  3988  		js.Pointer(&fn),
  3989  	)
  3990  	return
  3991  }
  3992  
  3993  // WriteDescriptorValue calls the function "WEBEXT.bluetoothLowEnergy.writeDescriptorValue" directly.
  3994  func WriteDescriptorValue(descriptorId js.String, value js.ArrayBuffer) (ret js.Promise[js.Void]) {
  3995  	bindings.CallWriteDescriptorValue(
  3996  		js.Pointer(&ret),
  3997  		descriptorId.Ref(),
  3998  		value.Ref(),
  3999  	)
  4000  
  4001  	return
  4002  }
  4003  
  4004  // TryWriteDescriptorValue calls the function "WEBEXT.bluetoothLowEnergy.writeDescriptorValue"
  4005  // in a try/catch block and returns (_, err, ok = false) when it went through
  4006  // the catch clause.
  4007  func TryWriteDescriptorValue(descriptorId js.String, value js.ArrayBuffer) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  4008  	ok = js.True == bindings.TryWriteDescriptorValue(
  4009  		js.Pointer(&ret), js.Pointer(&exception),
  4010  		descriptorId.Ref(),
  4011  		value.Ref(),
  4012  	)
  4013  
  4014  	return
  4015  }