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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package imagewriterprivate
     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/imagewriterprivate/bindings"
    11  )
    12  
    13  type DestroyPartitionsCallbackFunc func(this js.Ref) js.Ref
    14  
    15  func (fn DestroyPartitionsCallbackFunc) Register() js.Func[func()] {
    16  	return js.RegisterCallback[func()](
    17  		fn, abi.FuncPCABIInternal(fn),
    18  	)
    19  }
    20  
    21  func (fn DestroyPartitionsCallbackFunc) DispatchCallback(
    22  	targetPC uintptr, ctx *js.CallbackContext,
    23  ) {
    24  	args := ctx.Args()
    25  	if len(args) != 0+1 /* js this */ ||
    26  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    27  		js.ThrowInvalidCallbackInvocation()
    28  	}
    29  
    30  	if ctx.Return(fn(
    31  		args[0],
    32  	)) {
    33  		return
    34  	}
    35  
    36  	js.ThrowCallbackValueNotReturned()
    37  }
    38  
    39  type DestroyPartitionsCallback[T any] struct {
    40  	Fn  func(arg T, this js.Ref) js.Ref
    41  	Arg T
    42  }
    43  
    44  func (cb *DestroyPartitionsCallback[T]) Register() js.Func[func()] {
    45  	return js.RegisterCallback[func()](
    46  		cb, abi.FuncPCABIInternal(cb.Fn),
    47  	)
    48  }
    49  
    50  func (cb *DestroyPartitionsCallback[T]) DispatchCallback(
    51  	targetPC uintptr, ctx *js.CallbackContext,
    52  ) {
    53  	args := ctx.Args()
    54  	if len(args) != 0+1 /* js this */ ||
    55  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
    56  		js.ThrowInvalidCallbackInvocation()
    57  	}
    58  
    59  	if ctx.Return(cb.Fn(
    60  		cb.Arg,
    61  		args[0],
    62  	)) {
    63  		return
    64  	}
    65  
    66  	js.ThrowCallbackValueNotReturned()
    67  }
    68  
    69  type ListRemovableStorageDevicesCallbackFunc func(this js.Ref, devices js.Array[RemovableStorageDevice]) js.Ref
    70  
    71  func (fn ListRemovableStorageDevicesCallbackFunc) Register() js.Func[func(devices js.Array[RemovableStorageDevice])] {
    72  	return js.RegisterCallback[func(devices js.Array[RemovableStorageDevice])](
    73  		fn, abi.FuncPCABIInternal(fn),
    74  	)
    75  }
    76  
    77  func (fn ListRemovableStorageDevicesCallbackFunc) DispatchCallback(
    78  	targetPC uintptr, ctx *js.CallbackContext,
    79  ) {
    80  	args := ctx.Args()
    81  	if len(args) != 1+1 /* js this */ ||
    82  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    83  		js.ThrowInvalidCallbackInvocation()
    84  	}
    85  
    86  	if ctx.Return(fn(
    87  		args[0],
    88  
    89  		js.Array[RemovableStorageDevice]{}.FromRef(args[0+1]),
    90  	)) {
    91  		return
    92  	}
    93  
    94  	js.ThrowCallbackValueNotReturned()
    95  }
    96  
    97  type ListRemovableStorageDevicesCallback[T any] struct {
    98  	Fn  func(arg T, this js.Ref, devices js.Array[RemovableStorageDevice]) js.Ref
    99  	Arg T
   100  }
   101  
   102  func (cb *ListRemovableStorageDevicesCallback[T]) Register() js.Func[func(devices js.Array[RemovableStorageDevice])] {
   103  	return js.RegisterCallback[func(devices js.Array[RemovableStorageDevice])](
   104  		cb, abi.FuncPCABIInternal(cb.Fn),
   105  	)
   106  }
   107  
   108  func (cb *ListRemovableStorageDevicesCallback[T]) DispatchCallback(
   109  	targetPC uintptr, ctx *js.CallbackContext,
   110  ) {
   111  	args := ctx.Args()
   112  	if len(args) != 1+1 /* js this */ ||
   113  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   114  		js.ThrowInvalidCallbackInvocation()
   115  	}
   116  
   117  	if ctx.Return(cb.Fn(
   118  		cb.Arg,
   119  		args[0],
   120  
   121  		js.Array[RemovableStorageDevice]{}.FromRef(args[0+1]),
   122  	)) {
   123  		return
   124  	}
   125  
   126  	js.ThrowCallbackValueNotReturned()
   127  }
   128  
   129  type RemovableStorageDevice struct {
   130  	// StorageUnitId is "RemovableStorageDevice.storageUnitId"
   131  	//
   132  	// Optional
   133  	StorageUnitId js.String
   134  	// Capacity is "RemovableStorageDevice.capacity"
   135  	//
   136  	// Optional
   137  	//
   138  	// NOTE: FFI_USE_Capacity MUST be set to true to make this field effective.
   139  	Capacity float64
   140  	// Vendor is "RemovableStorageDevice.vendor"
   141  	//
   142  	// Optional
   143  	Vendor js.String
   144  	// Model is "RemovableStorageDevice.model"
   145  	//
   146  	// Optional
   147  	Model js.String
   148  	// Removable is "RemovableStorageDevice.removable"
   149  	//
   150  	// Optional
   151  	//
   152  	// NOTE: FFI_USE_Removable MUST be set to true to make this field effective.
   153  	Removable bool
   154  
   155  	FFI_USE_Capacity  bool // for Capacity.
   156  	FFI_USE_Removable bool // for Removable.
   157  
   158  	FFI_USE bool
   159  }
   160  
   161  // FromRef calls UpdateFrom and returns a RemovableStorageDevice with all fields set.
   162  func (p RemovableStorageDevice) FromRef(ref js.Ref) RemovableStorageDevice {
   163  	p.UpdateFrom(ref)
   164  	return p
   165  }
   166  
   167  // New creates a new RemovableStorageDevice in the application heap.
   168  func (p RemovableStorageDevice) New() js.Ref {
   169  	return bindings.RemovableStorageDeviceJSLoad(
   170  		js.Pointer(&p), js.True, 0,
   171  	)
   172  }
   173  
   174  // UpdateFrom copies value of all fields of the heap object to p.
   175  func (p *RemovableStorageDevice) UpdateFrom(ref js.Ref) {
   176  	bindings.RemovableStorageDeviceJSStore(
   177  		js.Pointer(p), ref,
   178  	)
   179  }
   180  
   181  // Update writes all fields of the p to the heap object referenced by ref.
   182  func (p *RemovableStorageDevice) Update(ref js.Ref) {
   183  	bindings.RemovableStorageDeviceJSLoad(
   184  		js.Pointer(p), js.False, ref,
   185  	)
   186  }
   187  
   188  // FreeMembers frees fields with heap reference, if recursive is true
   189  // free all heap references reachable from p.
   190  func (p *RemovableStorageDevice) FreeMembers(recursive bool) {
   191  	js.Free(
   192  		p.StorageUnitId.Ref(),
   193  		p.Vendor.Ref(),
   194  		p.Model.Ref(),
   195  	)
   196  	p.StorageUnitId = p.StorageUnitId.FromRef(js.Undefined)
   197  	p.Vendor = p.Vendor.FromRef(js.Undefined)
   198  	p.Model = p.Model.FromRef(js.Undefined)
   199  }
   200  
   201  type Stage uint32
   202  
   203  const (
   204  	_ Stage = iota
   205  
   206  	Stage_CONFIRMATION
   207  	Stage_DOWNLOAD
   208  	Stage_VERIFY_DOWNLOAD
   209  	Stage_UNZIP
   210  	Stage_WRITE
   211  	Stage_VERIFY_WRITE
   212  	Stage_UNKNOWN
   213  )
   214  
   215  func (Stage) FromRef(str js.Ref) Stage {
   216  	return Stage(bindings.ConstOfStage(str))
   217  }
   218  
   219  func (x Stage) String() (string, bool) {
   220  	switch x {
   221  	case Stage_CONFIRMATION:
   222  		return "confirmation", true
   223  	case Stage_DOWNLOAD:
   224  		return "download", true
   225  	case Stage_VERIFY_DOWNLOAD:
   226  		return "verifyDownload", true
   227  	case Stage_UNZIP:
   228  		return "unzip", true
   229  	case Stage_WRITE:
   230  		return "write", true
   231  	case Stage_VERIFY_WRITE:
   232  		return "verifyWrite", true
   233  	case Stage_UNKNOWN:
   234  		return "unknown", true
   235  	default:
   236  		return "", false
   237  	}
   238  }
   239  
   240  type ProgressInfo struct {
   241  	// Stage is "ProgressInfo.stage"
   242  	//
   243  	// Optional
   244  	Stage Stage
   245  	// PercentComplete is "ProgressInfo.percentComplete"
   246  	//
   247  	// Optional
   248  	//
   249  	// NOTE: FFI_USE_PercentComplete MUST be set to true to make this field effective.
   250  	PercentComplete int32
   251  
   252  	FFI_USE_PercentComplete bool // for PercentComplete.
   253  
   254  	FFI_USE bool
   255  }
   256  
   257  // FromRef calls UpdateFrom and returns a ProgressInfo with all fields set.
   258  func (p ProgressInfo) FromRef(ref js.Ref) ProgressInfo {
   259  	p.UpdateFrom(ref)
   260  	return p
   261  }
   262  
   263  // New creates a new ProgressInfo in the application heap.
   264  func (p ProgressInfo) New() js.Ref {
   265  	return bindings.ProgressInfoJSLoad(
   266  		js.Pointer(&p), js.True, 0,
   267  	)
   268  }
   269  
   270  // UpdateFrom copies value of all fields of the heap object to p.
   271  func (p *ProgressInfo) UpdateFrom(ref js.Ref) {
   272  	bindings.ProgressInfoJSStore(
   273  		js.Pointer(p), ref,
   274  	)
   275  }
   276  
   277  // Update writes all fields of the p to the heap object referenced by ref.
   278  func (p *ProgressInfo) Update(ref js.Ref) {
   279  	bindings.ProgressInfoJSLoad(
   280  		js.Pointer(p), js.False, ref,
   281  	)
   282  }
   283  
   284  // FreeMembers frees fields with heap reference, if recursive is true
   285  // free all heap references reachable from p.
   286  func (p *ProgressInfo) FreeMembers(recursive bool) {
   287  }
   288  
   289  type UrlWriteOptions struct {
   290  	// ImageHash is "UrlWriteOptions.imageHash"
   291  	//
   292  	// Optional
   293  	ImageHash js.String
   294  	// SaveAsDownload is "UrlWriteOptions.saveAsDownload"
   295  	//
   296  	// Optional
   297  	//
   298  	// NOTE: FFI_USE_SaveAsDownload MUST be set to true to make this field effective.
   299  	SaveAsDownload bool
   300  
   301  	FFI_USE_SaveAsDownload bool // for SaveAsDownload.
   302  
   303  	FFI_USE bool
   304  }
   305  
   306  // FromRef calls UpdateFrom and returns a UrlWriteOptions with all fields set.
   307  func (p UrlWriteOptions) FromRef(ref js.Ref) UrlWriteOptions {
   308  	p.UpdateFrom(ref)
   309  	return p
   310  }
   311  
   312  // New creates a new UrlWriteOptions in the application heap.
   313  func (p UrlWriteOptions) New() js.Ref {
   314  	return bindings.UrlWriteOptionsJSLoad(
   315  		js.Pointer(&p), js.True, 0,
   316  	)
   317  }
   318  
   319  // UpdateFrom copies value of all fields of the heap object to p.
   320  func (p *UrlWriteOptions) UpdateFrom(ref js.Ref) {
   321  	bindings.UrlWriteOptionsJSStore(
   322  		js.Pointer(p), ref,
   323  	)
   324  }
   325  
   326  // Update writes all fields of the p to the heap object referenced by ref.
   327  func (p *UrlWriteOptions) Update(ref js.Ref) {
   328  	bindings.UrlWriteOptionsJSLoad(
   329  		js.Pointer(p), js.False, ref,
   330  	)
   331  }
   332  
   333  // FreeMembers frees fields with heap reference, if recursive is true
   334  // free all heap references reachable from p.
   335  func (p *UrlWriteOptions) FreeMembers(recursive bool) {
   336  	js.Free(
   337  		p.ImageHash.Ref(),
   338  	)
   339  	p.ImageHash = p.ImageHash.FromRef(js.Undefined)
   340  }
   341  
   342  type WriteCancelCallbackFunc func(this js.Ref) js.Ref
   343  
   344  func (fn WriteCancelCallbackFunc) Register() js.Func[func()] {
   345  	return js.RegisterCallback[func()](
   346  		fn, abi.FuncPCABIInternal(fn),
   347  	)
   348  }
   349  
   350  func (fn WriteCancelCallbackFunc) DispatchCallback(
   351  	targetPC uintptr, ctx *js.CallbackContext,
   352  ) {
   353  	args := ctx.Args()
   354  	if len(args) != 0+1 /* js this */ ||
   355  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   356  		js.ThrowInvalidCallbackInvocation()
   357  	}
   358  
   359  	if ctx.Return(fn(
   360  		args[0],
   361  	)) {
   362  		return
   363  	}
   364  
   365  	js.ThrowCallbackValueNotReturned()
   366  }
   367  
   368  type WriteCancelCallback[T any] struct {
   369  	Fn  func(arg T, this js.Ref) js.Ref
   370  	Arg T
   371  }
   372  
   373  func (cb *WriteCancelCallback[T]) Register() js.Func[func()] {
   374  	return js.RegisterCallback[func()](
   375  		cb, abi.FuncPCABIInternal(cb.Fn),
   376  	)
   377  }
   378  
   379  func (cb *WriteCancelCallback[T]) DispatchCallback(
   380  	targetPC uintptr, ctx *js.CallbackContext,
   381  ) {
   382  	args := ctx.Args()
   383  	if len(args) != 0+1 /* js this */ ||
   384  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   385  		js.ThrowInvalidCallbackInvocation()
   386  	}
   387  
   388  	if ctx.Return(cb.Fn(
   389  		cb.Arg,
   390  		args[0],
   391  	)) {
   392  		return
   393  	}
   394  
   395  	js.ThrowCallbackValueNotReturned()
   396  }
   397  
   398  type WriteImageCallbackFunc func(this js.Ref) js.Ref
   399  
   400  func (fn WriteImageCallbackFunc) Register() js.Func[func()] {
   401  	return js.RegisterCallback[func()](
   402  		fn, abi.FuncPCABIInternal(fn),
   403  	)
   404  }
   405  
   406  func (fn WriteImageCallbackFunc) DispatchCallback(
   407  	targetPC uintptr, ctx *js.CallbackContext,
   408  ) {
   409  	args := ctx.Args()
   410  	if len(args) != 0+1 /* js this */ ||
   411  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   412  		js.ThrowInvalidCallbackInvocation()
   413  	}
   414  
   415  	if ctx.Return(fn(
   416  		args[0],
   417  	)) {
   418  		return
   419  	}
   420  
   421  	js.ThrowCallbackValueNotReturned()
   422  }
   423  
   424  type WriteImageCallback[T any] struct {
   425  	Fn  func(arg T, this js.Ref) js.Ref
   426  	Arg T
   427  }
   428  
   429  func (cb *WriteImageCallback[T]) Register() js.Func[func()] {
   430  	return js.RegisterCallback[func()](
   431  		cb, abi.FuncPCABIInternal(cb.Fn),
   432  	)
   433  }
   434  
   435  func (cb *WriteImageCallback[T]) DispatchCallback(
   436  	targetPC uintptr, ctx *js.CallbackContext,
   437  ) {
   438  	args := ctx.Args()
   439  	if len(args) != 0+1 /* js this */ ||
   440  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   441  		js.ThrowInvalidCallbackInvocation()
   442  	}
   443  
   444  	if ctx.Return(cb.Fn(
   445  		cb.Arg,
   446  		args[0],
   447  	)) {
   448  		return
   449  	}
   450  
   451  	js.ThrowCallbackValueNotReturned()
   452  }
   453  
   454  // HasFuncCancelWrite returns true if the function "WEBEXT.imageWriterPrivate.cancelWrite" exists.
   455  func HasFuncCancelWrite() bool {
   456  	return js.True == bindings.HasFuncCancelWrite()
   457  }
   458  
   459  // FuncCancelWrite returns the function "WEBEXT.imageWriterPrivate.cancelWrite".
   460  func FuncCancelWrite() (fn js.Func[func() js.Promise[js.Void]]) {
   461  	bindings.FuncCancelWrite(
   462  		js.Pointer(&fn),
   463  	)
   464  	return
   465  }
   466  
   467  // CancelWrite calls the function "WEBEXT.imageWriterPrivate.cancelWrite" directly.
   468  func CancelWrite() (ret js.Promise[js.Void]) {
   469  	bindings.CallCancelWrite(
   470  		js.Pointer(&ret),
   471  	)
   472  
   473  	return
   474  }
   475  
   476  // TryCancelWrite calls the function "WEBEXT.imageWriterPrivate.cancelWrite"
   477  // in a try/catch block and returns (_, err, ok = false) when it went through
   478  // the catch clause.
   479  func TryCancelWrite() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   480  	ok = js.True == bindings.TryCancelWrite(
   481  		js.Pointer(&ret), js.Pointer(&exception),
   482  	)
   483  
   484  	return
   485  }
   486  
   487  // HasFuncDestroyPartitions returns true if the function "WEBEXT.imageWriterPrivate.destroyPartitions" exists.
   488  func HasFuncDestroyPartitions() bool {
   489  	return js.True == bindings.HasFuncDestroyPartitions()
   490  }
   491  
   492  // FuncDestroyPartitions returns the function "WEBEXT.imageWriterPrivate.destroyPartitions".
   493  func FuncDestroyPartitions() (fn js.Func[func(storageUnitId js.String) js.Promise[js.Void]]) {
   494  	bindings.FuncDestroyPartitions(
   495  		js.Pointer(&fn),
   496  	)
   497  	return
   498  }
   499  
   500  // DestroyPartitions calls the function "WEBEXT.imageWriterPrivate.destroyPartitions" directly.
   501  func DestroyPartitions(storageUnitId js.String) (ret js.Promise[js.Void]) {
   502  	bindings.CallDestroyPartitions(
   503  		js.Pointer(&ret),
   504  		storageUnitId.Ref(),
   505  	)
   506  
   507  	return
   508  }
   509  
   510  // TryDestroyPartitions calls the function "WEBEXT.imageWriterPrivate.destroyPartitions"
   511  // in a try/catch block and returns (_, err, ok = false) when it went through
   512  // the catch clause.
   513  func TryDestroyPartitions(storageUnitId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   514  	ok = js.True == bindings.TryDestroyPartitions(
   515  		js.Pointer(&ret), js.Pointer(&exception),
   516  		storageUnitId.Ref(),
   517  	)
   518  
   519  	return
   520  }
   521  
   522  // HasFuncListRemovableStorageDevices returns true if the function "WEBEXT.imageWriterPrivate.listRemovableStorageDevices" exists.
   523  func HasFuncListRemovableStorageDevices() bool {
   524  	return js.True == bindings.HasFuncListRemovableStorageDevices()
   525  }
   526  
   527  // FuncListRemovableStorageDevices returns the function "WEBEXT.imageWriterPrivate.listRemovableStorageDevices".
   528  func FuncListRemovableStorageDevices() (fn js.Func[func() js.Promise[js.Array[RemovableStorageDevice]]]) {
   529  	bindings.FuncListRemovableStorageDevices(
   530  		js.Pointer(&fn),
   531  	)
   532  	return
   533  }
   534  
   535  // ListRemovableStorageDevices calls the function "WEBEXT.imageWriterPrivate.listRemovableStorageDevices" directly.
   536  func ListRemovableStorageDevices() (ret js.Promise[js.Array[RemovableStorageDevice]]) {
   537  	bindings.CallListRemovableStorageDevices(
   538  		js.Pointer(&ret),
   539  	)
   540  
   541  	return
   542  }
   543  
   544  // TryListRemovableStorageDevices calls the function "WEBEXT.imageWriterPrivate.listRemovableStorageDevices"
   545  // in a try/catch block and returns (_, err, ok = false) when it went through
   546  // the catch clause.
   547  func TryListRemovableStorageDevices() (ret js.Promise[js.Array[RemovableStorageDevice]], exception js.Any, ok bool) {
   548  	ok = js.True == bindings.TryListRemovableStorageDevices(
   549  		js.Pointer(&ret), js.Pointer(&exception),
   550  	)
   551  
   552  	return
   553  }
   554  
   555  type OnDeviceInsertedEventCallbackFunc func(this js.Ref, device *RemovableStorageDevice) js.Ref
   556  
   557  func (fn OnDeviceInsertedEventCallbackFunc) Register() js.Func[func(device *RemovableStorageDevice)] {
   558  	return js.RegisterCallback[func(device *RemovableStorageDevice)](
   559  		fn, abi.FuncPCABIInternal(fn),
   560  	)
   561  }
   562  
   563  func (fn OnDeviceInsertedEventCallbackFunc) DispatchCallback(
   564  	targetPC uintptr, ctx *js.CallbackContext,
   565  ) {
   566  	args := ctx.Args()
   567  	if len(args) != 1+1 /* js this */ ||
   568  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   569  		js.ThrowInvalidCallbackInvocation()
   570  	}
   571  	var arg0 RemovableStorageDevice
   572  	arg0.UpdateFrom(args[0+1])
   573  	defer arg0.FreeMembers(true)
   574  
   575  	if ctx.Return(fn(
   576  		args[0],
   577  
   578  		mark.NoEscape(&arg0),
   579  	)) {
   580  		return
   581  	}
   582  
   583  	js.ThrowCallbackValueNotReturned()
   584  }
   585  
   586  type OnDeviceInsertedEventCallback[T any] struct {
   587  	Fn  func(arg T, this js.Ref, device *RemovableStorageDevice) js.Ref
   588  	Arg T
   589  }
   590  
   591  func (cb *OnDeviceInsertedEventCallback[T]) Register() js.Func[func(device *RemovableStorageDevice)] {
   592  	return js.RegisterCallback[func(device *RemovableStorageDevice)](
   593  		cb, abi.FuncPCABIInternal(cb.Fn),
   594  	)
   595  }
   596  
   597  func (cb *OnDeviceInsertedEventCallback[T]) DispatchCallback(
   598  	targetPC uintptr, ctx *js.CallbackContext,
   599  ) {
   600  	args := ctx.Args()
   601  	if len(args) != 1+1 /* js this */ ||
   602  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   603  		js.ThrowInvalidCallbackInvocation()
   604  	}
   605  	var arg0 RemovableStorageDevice
   606  	arg0.UpdateFrom(args[0+1])
   607  	defer arg0.FreeMembers(true)
   608  
   609  	if ctx.Return(cb.Fn(
   610  		cb.Arg,
   611  		args[0],
   612  
   613  		mark.NoEscape(&arg0),
   614  	)) {
   615  		return
   616  	}
   617  
   618  	js.ThrowCallbackValueNotReturned()
   619  }
   620  
   621  // HasFuncOnDeviceInserted returns true if the function "WEBEXT.imageWriterPrivate.onDeviceInserted.addListener" exists.
   622  func HasFuncOnDeviceInserted() bool {
   623  	return js.True == bindings.HasFuncOnDeviceInserted()
   624  }
   625  
   626  // FuncOnDeviceInserted returns the function "WEBEXT.imageWriterPrivate.onDeviceInserted.addListener".
   627  func FuncOnDeviceInserted() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)])]) {
   628  	bindings.FuncOnDeviceInserted(
   629  		js.Pointer(&fn),
   630  	)
   631  	return
   632  }
   633  
   634  // OnDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.addListener" directly.
   635  func OnDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void) {
   636  	bindings.CallOnDeviceInserted(
   637  		js.Pointer(&ret),
   638  		callback.Ref(),
   639  	)
   640  
   641  	return
   642  }
   643  
   644  // TryOnDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.addListener"
   645  // in a try/catch block and returns (_, err, ok = false) when it went through
   646  // the catch clause.
   647  func TryOnDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void, exception js.Any, ok bool) {
   648  	ok = js.True == bindings.TryOnDeviceInserted(
   649  		js.Pointer(&ret), js.Pointer(&exception),
   650  		callback.Ref(),
   651  	)
   652  
   653  	return
   654  }
   655  
   656  // HasFuncOffDeviceInserted returns true if the function "WEBEXT.imageWriterPrivate.onDeviceInserted.removeListener" exists.
   657  func HasFuncOffDeviceInserted() bool {
   658  	return js.True == bindings.HasFuncOffDeviceInserted()
   659  }
   660  
   661  // FuncOffDeviceInserted returns the function "WEBEXT.imageWriterPrivate.onDeviceInserted.removeListener".
   662  func FuncOffDeviceInserted() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)])]) {
   663  	bindings.FuncOffDeviceInserted(
   664  		js.Pointer(&fn),
   665  	)
   666  	return
   667  }
   668  
   669  // OffDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.removeListener" directly.
   670  func OffDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void) {
   671  	bindings.CallOffDeviceInserted(
   672  		js.Pointer(&ret),
   673  		callback.Ref(),
   674  	)
   675  
   676  	return
   677  }
   678  
   679  // TryOffDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.removeListener"
   680  // in a try/catch block and returns (_, err, ok = false) when it went through
   681  // the catch clause.
   682  func TryOffDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void, exception js.Any, ok bool) {
   683  	ok = js.True == bindings.TryOffDeviceInserted(
   684  		js.Pointer(&ret), js.Pointer(&exception),
   685  		callback.Ref(),
   686  	)
   687  
   688  	return
   689  }
   690  
   691  // HasFuncHasOnDeviceInserted returns true if the function "WEBEXT.imageWriterPrivate.onDeviceInserted.hasListener" exists.
   692  func HasFuncHasOnDeviceInserted() bool {
   693  	return js.True == bindings.HasFuncHasOnDeviceInserted()
   694  }
   695  
   696  // FuncHasOnDeviceInserted returns the function "WEBEXT.imageWriterPrivate.onDeviceInserted.hasListener".
   697  func FuncHasOnDeviceInserted() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)]) bool]) {
   698  	bindings.FuncHasOnDeviceInserted(
   699  		js.Pointer(&fn),
   700  	)
   701  	return
   702  }
   703  
   704  // HasOnDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.hasListener" directly.
   705  func HasOnDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret bool) {
   706  	bindings.CallHasOnDeviceInserted(
   707  		js.Pointer(&ret),
   708  		callback.Ref(),
   709  	)
   710  
   711  	return
   712  }
   713  
   714  // TryHasOnDeviceInserted calls the function "WEBEXT.imageWriterPrivate.onDeviceInserted.hasListener"
   715  // in a try/catch block and returns (_, err, ok = false) when it went through
   716  // the catch clause.
   717  func TryHasOnDeviceInserted(callback js.Func[func(device *RemovableStorageDevice)]) (ret bool, exception js.Any, ok bool) {
   718  	ok = js.True == bindings.TryHasOnDeviceInserted(
   719  		js.Pointer(&ret), js.Pointer(&exception),
   720  		callback.Ref(),
   721  	)
   722  
   723  	return
   724  }
   725  
   726  type OnDeviceRemovedEventCallbackFunc func(this js.Ref, device *RemovableStorageDevice) js.Ref
   727  
   728  func (fn OnDeviceRemovedEventCallbackFunc) Register() js.Func[func(device *RemovableStorageDevice)] {
   729  	return js.RegisterCallback[func(device *RemovableStorageDevice)](
   730  		fn, abi.FuncPCABIInternal(fn),
   731  	)
   732  }
   733  
   734  func (fn OnDeviceRemovedEventCallbackFunc) DispatchCallback(
   735  	targetPC uintptr, ctx *js.CallbackContext,
   736  ) {
   737  	args := ctx.Args()
   738  	if len(args) != 1+1 /* js this */ ||
   739  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   740  		js.ThrowInvalidCallbackInvocation()
   741  	}
   742  	var arg0 RemovableStorageDevice
   743  	arg0.UpdateFrom(args[0+1])
   744  	defer arg0.FreeMembers(true)
   745  
   746  	if ctx.Return(fn(
   747  		args[0],
   748  
   749  		mark.NoEscape(&arg0),
   750  	)) {
   751  		return
   752  	}
   753  
   754  	js.ThrowCallbackValueNotReturned()
   755  }
   756  
   757  type OnDeviceRemovedEventCallback[T any] struct {
   758  	Fn  func(arg T, this js.Ref, device *RemovableStorageDevice) js.Ref
   759  	Arg T
   760  }
   761  
   762  func (cb *OnDeviceRemovedEventCallback[T]) Register() js.Func[func(device *RemovableStorageDevice)] {
   763  	return js.RegisterCallback[func(device *RemovableStorageDevice)](
   764  		cb, abi.FuncPCABIInternal(cb.Fn),
   765  	)
   766  }
   767  
   768  func (cb *OnDeviceRemovedEventCallback[T]) DispatchCallback(
   769  	targetPC uintptr, ctx *js.CallbackContext,
   770  ) {
   771  	args := ctx.Args()
   772  	if len(args) != 1+1 /* js this */ ||
   773  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   774  		js.ThrowInvalidCallbackInvocation()
   775  	}
   776  	var arg0 RemovableStorageDevice
   777  	arg0.UpdateFrom(args[0+1])
   778  	defer arg0.FreeMembers(true)
   779  
   780  	if ctx.Return(cb.Fn(
   781  		cb.Arg,
   782  		args[0],
   783  
   784  		mark.NoEscape(&arg0),
   785  	)) {
   786  		return
   787  	}
   788  
   789  	js.ThrowCallbackValueNotReturned()
   790  }
   791  
   792  // HasFuncOnDeviceRemoved returns true if the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.addListener" exists.
   793  func HasFuncOnDeviceRemoved() bool {
   794  	return js.True == bindings.HasFuncOnDeviceRemoved()
   795  }
   796  
   797  // FuncOnDeviceRemoved returns the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.addListener".
   798  func FuncOnDeviceRemoved() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)])]) {
   799  	bindings.FuncOnDeviceRemoved(
   800  		js.Pointer(&fn),
   801  	)
   802  	return
   803  }
   804  
   805  // OnDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.addListener" directly.
   806  func OnDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void) {
   807  	bindings.CallOnDeviceRemoved(
   808  		js.Pointer(&ret),
   809  		callback.Ref(),
   810  	)
   811  
   812  	return
   813  }
   814  
   815  // TryOnDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.addListener"
   816  // in a try/catch block and returns (_, err, ok = false) when it went through
   817  // the catch clause.
   818  func TryOnDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void, exception js.Any, ok bool) {
   819  	ok = js.True == bindings.TryOnDeviceRemoved(
   820  		js.Pointer(&ret), js.Pointer(&exception),
   821  		callback.Ref(),
   822  	)
   823  
   824  	return
   825  }
   826  
   827  // HasFuncOffDeviceRemoved returns true if the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.removeListener" exists.
   828  func HasFuncOffDeviceRemoved() bool {
   829  	return js.True == bindings.HasFuncOffDeviceRemoved()
   830  }
   831  
   832  // FuncOffDeviceRemoved returns the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.removeListener".
   833  func FuncOffDeviceRemoved() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)])]) {
   834  	bindings.FuncOffDeviceRemoved(
   835  		js.Pointer(&fn),
   836  	)
   837  	return
   838  }
   839  
   840  // OffDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.removeListener" directly.
   841  func OffDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void) {
   842  	bindings.CallOffDeviceRemoved(
   843  		js.Pointer(&ret),
   844  		callback.Ref(),
   845  	)
   846  
   847  	return
   848  }
   849  
   850  // TryOffDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.removeListener"
   851  // in a try/catch block and returns (_, err, ok = false) when it went through
   852  // the catch clause.
   853  func TryOffDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret js.Void, exception js.Any, ok bool) {
   854  	ok = js.True == bindings.TryOffDeviceRemoved(
   855  		js.Pointer(&ret), js.Pointer(&exception),
   856  		callback.Ref(),
   857  	)
   858  
   859  	return
   860  }
   861  
   862  // HasFuncHasOnDeviceRemoved returns true if the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.hasListener" exists.
   863  func HasFuncHasOnDeviceRemoved() bool {
   864  	return js.True == bindings.HasFuncHasOnDeviceRemoved()
   865  }
   866  
   867  // FuncHasOnDeviceRemoved returns the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.hasListener".
   868  func FuncHasOnDeviceRemoved() (fn js.Func[func(callback js.Func[func(device *RemovableStorageDevice)]) bool]) {
   869  	bindings.FuncHasOnDeviceRemoved(
   870  		js.Pointer(&fn),
   871  	)
   872  	return
   873  }
   874  
   875  // HasOnDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.hasListener" directly.
   876  func HasOnDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret bool) {
   877  	bindings.CallHasOnDeviceRemoved(
   878  		js.Pointer(&ret),
   879  		callback.Ref(),
   880  	)
   881  
   882  	return
   883  }
   884  
   885  // TryHasOnDeviceRemoved calls the function "WEBEXT.imageWriterPrivate.onDeviceRemoved.hasListener"
   886  // in a try/catch block and returns (_, err, ok = false) when it went through
   887  // the catch clause.
   888  func TryHasOnDeviceRemoved(callback js.Func[func(device *RemovableStorageDevice)]) (ret bool, exception js.Any, ok bool) {
   889  	ok = js.True == bindings.TryHasOnDeviceRemoved(
   890  		js.Pointer(&ret), js.Pointer(&exception),
   891  		callback.Ref(),
   892  	)
   893  
   894  	return
   895  }
   896  
   897  type OnWriteCompleteEventCallbackFunc func(this js.Ref) js.Ref
   898  
   899  func (fn OnWriteCompleteEventCallbackFunc) Register() js.Func[func()] {
   900  	return js.RegisterCallback[func()](
   901  		fn, abi.FuncPCABIInternal(fn),
   902  	)
   903  }
   904  
   905  func (fn OnWriteCompleteEventCallbackFunc) DispatchCallback(
   906  	targetPC uintptr, ctx *js.CallbackContext,
   907  ) {
   908  	args := ctx.Args()
   909  	if len(args) != 0+1 /* js this */ ||
   910  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   911  		js.ThrowInvalidCallbackInvocation()
   912  	}
   913  
   914  	if ctx.Return(fn(
   915  		args[0],
   916  	)) {
   917  		return
   918  	}
   919  
   920  	js.ThrowCallbackValueNotReturned()
   921  }
   922  
   923  type OnWriteCompleteEventCallback[T any] struct {
   924  	Fn  func(arg T, this js.Ref) js.Ref
   925  	Arg T
   926  }
   927  
   928  func (cb *OnWriteCompleteEventCallback[T]) Register() js.Func[func()] {
   929  	return js.RegisterCallback[func()](
   930  		cb, abi.FuncPCABIInternal(cb.Fn),
   931  	)
   932  }
   933  
   934  func (cb *OnWriteCompleteEventCallback[T]) DispatchCallback(
   935  	targetPC uintptr, ctx *js.CallbackContext,
   936  ) {
   937  	args := ctx.Args()
   938  	if len(args) != 0+1 /* js this */ ||
   939  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   940  		js.ThrowInvalidCallbackInvocation()
   941  	}
   942  
   943  	if ctx.Return(cb.Fn(
   944  		cb.Arg,
   945  		args[0],
   946  	)) {
   947  		return
   948  	}
   949  
   950  	js.ThrowCallbackValueNotReturned()
   951  }
   952  
   953  // HasFuncOnWriteComplete returns true if the function "WEBEXT.imageWriterPrivate.onWriteComplete.addListener" exists.
   954  func HasFuncOnWriteComplete() bool {
   955  	return js.True == bindings.HasFuncOnWriteComplete()
   956  }
   957  
   958  // FuncOnWriteComplete returns the function "WEBEXT.imageWriterPrivate.onWriteComplete.addListener".
   959  func FuncOnWriteComplete() (fn js.Func[func(callback js.Func[func()])]) {
   960  	bindings.FuncOnWriteComplete(
   961  		js.Pointer(&fn),
   962  	)
   963  	return
   964  }
   965  
   966  // OnWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.addListener" directly.
   967  func OnWriteComplete(callback js.Func[func()]) (ret js.Void) {
   968  	bindings.CallOnWriteComplete(
   969  		js.Pointer(&ret),
   970  		callback.Ref(),
   971  	)
   972  
   973  	return
   974  }
   975  
   976  // TryOnWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.addListener"
   977  // in a try/catch block and returns (_, err, ok = false) when it went through
   978  // the catch clause.
   979  func TryOnWriteComplete(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
   980  	ok = js.True == bindings.TryOnWriteComplete(
   981  		js.Pointer(&ret), js.Pointer(&exception),
   982  		callback.Ref(),
   983  	)
   984  
   985  	return
   986  }
   987  
   988  // HasFuncOffWriteComplete returns true if the function "WEBEXT.imageWriterPrivate.onWriteComplete.removeListener" exists.
   989  func HasFuncOffWriteComplete() bool {
   990  	return js.True == bindings.HasFuncOffWriteComplete()
   991  }
   992  
   993  // FuncOffWriteComplete returns the function "WEBEXT.imageWriterPrivate.onWriteComplete.removeListener".
   994  func FuncOffWriteComplete() (fn js.Func[func(callback js.Func[func()])]) {
   995  	bindings.FuncOffWriteComplete(
   996  		js.Pointer(&fn),
   997  	)
   998  	return
   999  }
  1000  
  1001  // OffWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.removeListener" directly.
  1002  func OffWriteComplete(callback js.Func[func()]) (ret js.Void) {
  1003  	bindings.CallOffWriteComplete(
  1004  		js.Pointer(&ret),
  1005  		callback.Ref(),
  1006  	)
  1007  
  1008  	return
  1009  }
  1010  
  1011  // TryOffWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.removeListener"
  1012  // in a try/catch block and returns (_, err, ok = false) when it went through
  1013  // the catch clause.
  1014  func TryOffWriteComplete(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
  1015  	ok = js.True == bindings.TryOffWriteComplete(
  1016  		js.Pointer(&ret), js.Pointer(&exception),
  1017  		callback.Ref(),
  1018  	)
  1019  
  1020  	return
  1021  }
  1022  
  1023  // HasFuncHasOnWriteComplete returns true if the function "WEBEXT.imageWriterPrivate.onWriteComplete.hasListener" exists.
  1024  func HasFuncHasOnWriteComplete() bool {
  1025  	return js.True == bindings.HasFuncHasOnWriteComplete()
  1026  }
  1027  
  1028  // FuncHasOnWriteComplete returns the function "WEBEXT.imageWriterPrivate.onWriteComplete.hasListener".
  1029  func FuncHasOnWriteComplete() (fn js.Func[func(callback js.Func[func()]) bool]) {
  1030  	bindings.FuncHasOnWriteComplete(
  1031  		js.Pointer(&fn),
  1032  	)
  1033  	return
  1034  }
  1035  
  1036  // HasOnWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.hasListener" directly.
  1037  func HasOnWriteComplete(callback js.Func[func()]) (ret bool) {
  1038  	bindings.CallHasOnWriteComplete(
  1039  		js.Pointer(&ret),
  1040  		callback.Ref(),
  1041  	)
  1042  
  1043  	return
  1044  }
  1045  
  1046  // TryHasOnWriteComplete calls the function "WEBEXT.imageWriterPrivate.onWriteComplete.hasListener"
  1047  // in a try/catch block and returns (_, err, ok = false) when it went through
  1048  // the catch clause.
  1049  func TryHasOnWriteComplete(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) {
  1050  	ok = js.True == bindings.TryHasOnWriteComplete(
  1051  		js.Pointer(&ret), js.Pointer(&exception),
  1052  		callback.Ref(),
  1053  	)
  1054  
  1055  	return
  1056  }
  1057  
  1058  type OnWriteErrorEventCallbackFunc func(this js.Ref, info *ProgressInfo, err js.String) js.Ref
  1059  
  1060  func (fn OnWriteErrorEventCallbackFunc) Register() js.Func[func(info *ProgressInfo, err js.String)] {
  1061  	return js.RegisterCallback[func(info *ProgressInfo, err js.String)](
  1062  		fn, abi.FuncPCABIInternal(fn),
  1063  	)
  1064  }
  1065  
  1066  func (fn OnWriteErrorEventCallbackFunc) DispatchCallback(
  1067  	targetPC uintptr, ctx *js.CallbackContext,
  1068  ) {
  1069  	args := ctx.Args()
  1070  	if len(args) != 2+1 /* js this */ ||
  1071  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1072  		js.ThrowInvalidCallbackInvocation()
  1073  	}
  1074  	var arg0 ProgressInfo
  1075  	arg0.UpdateFrom(args[0+1])
  1076  	defer arg0.FreeMembers(true)
  1077  
  1078  	if ctx.Return(fn(
  1079  		args[0],
  1080  
  1081  		mark.NoEscape(&arg0),
  1082  		js.String{}.FromRef(args[1+1]),
  1083  	)) {
  1084  		return
  1085  	}
  1086  
  1087  	js.ThrowCallbackValueNotReturned()
  1088  }
  1089  
  1090  type OnWriteErrorEventCallback[T any] struct {
  1091  	Fn  func(arg T, this js.Ref, info *ProgressInfo, err js.String) js.Ref
  1092  	Arg T
  1093  }
  1094  
  1095  func (cb *OnWriteErrorEventCallback[T]) Register() js.Func[func(info *ProgressInfo, err js.String)] {
  1096  	return js.RegisterCallback[func(info *ProgressInfo, err js.String)](
  1097  		cb, abi.FuncPCABIInternal(cb.Fn),
  1098  	)
  1099  }
  1100  
  1101  func (cb *OnWriteErrorEventCallback[T]) DispatchCallback(
  1102  	targetPC uintptr, ctx *js.CallbackContext,
  1103  ) {
  1104  	args := ctx.Args()
  1105  	if len(args) != 2+1 /* js this */ ||
  1106  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1107  		js.ThrowInvalidCallbackInvocation()
  1108  	}
  1109  	var arg0 ProgressInfo
  1110  	arg0.UpdateFrom(args[0+1])
  1111  	defer arg0.FreeMembers(true)
  1112  
  1113  	if ctx.Return(cb.Fn(
  1114  		cb.Arg,
  1115  		args[0],
  1116  
  1117  		mark.NoEscape(&arg0),
  1118  		js.String{}.FromRef(args[1+1]),
  1119  	)) {
  1120  		return
  1121  	}
  1122  
  1123  	js.ThrowCallbackValueNotReturned()
  1124  }
  1125  
  1126  // HasFuncOnWriteError returns true if the function "WEBEXT.imageWriterPrivate.onWriteError.addListener" exists.
  1127  func HasFuncOnWriteError() bool {
  1128  	return js.True == bindings.HasFuncOnWriteError()
  1129  }
  1130  
  1131  // FuncOnWriteError returns the function "WEBEXT.imageWriterPrivate.onWriteError.addListener".
  1132  func FuncOnWriteError() (fn js.Func[func(callback js.Func[func(info *ProgressInfo, err js.String)])]) {
  1133  	bindings.FuncOnWriteError(
  1134  		js.Pointer(&fn),
  1135  	)
  1136  	return
  1137  }
  1138  
  1139  // OnWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.addListener" directly.
  1140  func OnWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret js.Void) {
  1141  	bindings.CallOnWriteError(
  1142  		js.Pointer(&ret),
  1143  		callback.Ref(),
  1144  	)
  1145  
  1146  	return
  1147  }
  1148  
  1149  // TryOnWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.addListener"
  1150  // in a try/catch block and returns (_, err, ok = false) when it went through
  1151  // the catch clause.
  1152  func TryOnWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret js.Void, exception js.Any, ok bool) {
  1153  	ok = js.True == bindings.TryOnWriteError(
  1154  		js.Pointer(&ret), js.Pointer(&exception),
  1155  		callback.Ref(),
  1156  	)
  1157  
  1158  	return
  1159  }
  1160  
  1161  // HasFuncOffWriteError returns true if the function "WEBEXT.imageWriterPrivate.onWriteError.removeListener" exists.
  1162  func HasFuncOffWriteError() bool {
  1163  	return js.True == bindings.HasFuncOffWriteError()
  1164  }
  1165  
  1166  // FuncOffWriteError returns the function "WEBEXT.imageWriterPrivate.onWriteError.removeListener".
  1167  func FuncOffWriteError() (fn js.Func[func(callback js.Func[func(info *ProgressInfo, err js.String)])]) {
  1168  	bindings.FuncOffWriteError(
  1169  		js.Pointer(&fn),
  1170  	)
  1171  	return
  1172  }
  1173  
  1174  // OffWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.removeListener" directly.
  1175  func OffWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret js.Void) {
  1176  	bindings.CallOffWriteError(
  1177  		js.Pointer(&ret),
  1178  		callback.Ref(),
  1179  	)
  1180  
  1181  	return
  1182  }
  1183  
  1184  // TryOffWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.removeListener"
  1185  // in a try/catch block and returns (_, err, ok = false) when it went through
  1186  // the catch clause.
  1187  func TryOffWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret js.Void, exception js.Any, ok bool) {
  1188  	ok = js.True == bindings.TryOffWriteError(
  1189  		js.Pointer(&ret), js.Pointer(&exception),
  1190  		callback.Ref(),
  1191  	)
  1192  
  1193  	return
  1194  }
  1195  
  1196  // HasFuncHasOnWriteError returns true if the function "WEBEXT.imageWriterPrivate.onWriteError.hasListener" exists.
  1197  func HasFuncHasOnWriteError() bool {
  1198  	return js.True == bindings.HasFuncHasOnWriteError()
  1199  }
  1200  
  1201  // FuncHasOnWriteError returns the function "WEBEXT.imageWriterPrivate.onWriteError.hasListener".
  1202  func FuncHasOnWriteError() (fn js.Func[func(callback js.Func[func(info *ProgressInfo, err js.String)]) bool]) {
  1203  	bindings.FuncHasOnWriteError(
  1204  		js.Pointer(&fn),
  1205  	)
  1206  	return
  1207  }
  1208  
  1209  // HasOnWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.hasListener" directly.
  1210  func HasOnWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret bool) {
  1211  	bindings.CallHasOnWriteError(
  1212  		js.Pointer(&ret),
  1213  		callback.Ref(),
  1214  	)
  1215  
  1216  	return
  1217  }
  1218  
  1219  // TryHasOnWriteError calls the function "WEBEXT.imageWriterPrivate.onWriteError.hasListener"
  1220  // in a try/catch block and returns (_, err, ok = false) when it went through
  1221  // the catch clause.
  1222  func TryHasOnWriteError(callback js.Func[func(info *ProgressInfo, err js.String)]) (ret bool, exception js.Any, ok bool) {
  1223  	ok = js.True == bindings.TryHasOnWriteError(
  1224  		js.Pointer(&ret), js.Pointer(&exception),
  1225  		callback.Ref(),
  1226  	)
  1227  
  1228  	return
  1229  }
  1230  
  1231  type OnWriteProgressEventCallbackFunc func(this js.Ref, info *ProgressInfo) js.Ref
  1232  
  1233  func (fn OnWriteProgressEventCallbackFunc) Register() js.Func[func(info *ProgressInfo)] {
  1234  	return js.RegisterCallback[func(info *ProgressInfo)](
  1235  		fn, abi.FuncPCABIInternal(fn),
  1236  	)
  1237  }
  1238  
  1239  func (fn OnWriteProgressEventCallbackFunc) DispatchCallback(
  1240  	targetPC uintptr, ctx *js.CallbackContext,
  1241  ) {
  1242  	args := ctx.Args()
  1243  	if len(args) != 1+1 /* js this */ ||
  1244  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1245  		js.ThrowInvalidCallbackInvocation()
  1246  	}
  1247  	var arg0 ProgressInfo
  1248  	arg0.UpdateFrom(args[0+1])
  1249  	defer arg0.FreeMembers(true)
  1250  
  1251  	if ctx.Return(fn(
  1252  		args[0],
  1253  
  1254  		mark.NoEscape(&arg0),
  1255  	)) {
  1256  		return
  1257  	}
  1258  
  1259  	js.ThrowCallbackValueNotReturned()
  1260  }
  1261  
  1262  type OnWriteProgressEventCallback[T any] struct {
  1263  	Fn  func(arg T, this js.Ref, info *ProgressInfo) js.Ref
  1264  	Arg T
  1265  }
  1266  
  1267  func (cb *OnWriteProgressEventCallback[T]) Register() js.Func[func(info *ProgressInfo)] {
  1268  	return js.RegisterCallback[func(info *ProgressInfo)](
  1269  		cb, abi.FuncPCABIInternal(cb.Fn),
  1270  	)
  1271  }
  1272  
  1273  func (cb *OnWriteProgressEventCallback[T]) DispatchCallback(
  1274  	targetPC uintptr, ctx *js.CallbackContext,
  1275  ) {
  1276  	args := ctx.Args()
  1277  	if len(args) != 1+1 /* js this */ ||
  1278  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1279  		js.ThrowInvalidCallbackInvocation()
  1280  	}
  1281  	var arg0 ProgressInfo
  1282  	arg0.UpdateFrom(args[0+1])
  1283  	defer arg0.FreeMembers(true)
  1284  
  1285  	if ctx.Return(cb.Fn(
  1286  		cb.Arg,
  1287  		args[0],
  1288  
  1289  		mark.NoEscape(&arg0),
  1290  	)) {
  1291  		return
  1292  	}
  1293  
  1294  	js.ThrowCallbackValueNotReturned()
  1295  }
  1296  
  1297  // HasFuncOnWriteProgress returns true if the function "WEBEXT.imageWriterPrivate.onWriteProgress.addListener" exists.
  1298  func HasFuncOnWriteProgress() bool {
  1299  	return js.True == bindings.HasFuncOnWriteProgress()
  1300  }
  1301  
  1302  // FuncOnWriteProgress returns the function "WEBEXT.imageWriterPrivate.onWriteProgress.addListener".
  1303  func FuncOnWriteProgress() (fn js.Func[func(callback js.Func[func(info *ProgressInfo)])]) {
  1304  	bindings.FuncOnWriteProgress(
  1305  		js.Pointer(&fn),
  1306  	)
  1307  	return
  1308  }
  1309  
  1310  // OnWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.addListener" directly.
  1311  func OnWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret js.Void) {
  1312  	bindings.CallOnWriteProgress(
  1313  		js.Pointer(&ret),
  1314  		callback.Ref(),
  1315  	)
  1316  
  1317  	return
  1318  }
  1319  
  1320  // TryOnWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.addListener"
  1321  // in a try/catch block and returns (_, err, ok = false) when it went through
  1322  // the catch clause.
  1323  func TryOnWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1324  	ok = js.True == bindings.TryOnWriteProgress(
  1325  		js.Pointer(&ret), js.Pointer(&exception),
  1326  		callback.Ref(),
  1327  	)
  1328  
  1329  	return
  1330  }
  1331  
  1332  // HasFuncOffWriteProgress returns true if the function "WEBEXT.imageWriterPrivate.onWriteProgress.removeListener" exists.
  1333  func HasFuncOffWriteProgress() bool {
  1334  	return js.True == bindings.HasFuncOffWriteProgress()
  1335  }
  1336  
  1337  // FuncOffWriteProgress returns the function "WEBEXT.imageWriterPrivate.onWriteProgress.removeListener".
  1338  func FuncOffWriteProgress() (fn js.Func[func(callback js.Func[func(info *ProgressInfo)])]) {
  1339  	bindings.FuncOffWriteProgress(
  1340  		js.Pointer(&fn),
  1341  	)
  1342  	return
  1343  }
  1344  
  1345  // OffWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.removeListener" directly.
  1346  func OffWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret js.Void) {
  1347  	bindings.CallOffWriteProgress(
  1348  		js.Pointer(&ret),
  1349  		callback.Ref(),
  1350  	)
  1351  
  1352  	return
  1353  }
  1354  
  1355  // TryOffWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.removeListener"
  1356  // in a try/catch block and returns (_, err, ok = false) when it went through
  1357  // the catch clause.
  1358  func TryOffWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret js.Void, exception js.Any, ok bool) {
  1359  	ok = js.True == bindings.TryOffWriteProgress(
  1360  		js.Pointer(&ret), js.Pointer(&exception),
  1361  		callback.Ref(),
  1362  	)
  1363  
  1364  	return
  1365  }
  1366  
  1367  // HasFuncHasOnWriteProgress returns true if the function "WEBEXT.imageWriterPrivate.onWriteProgress.hasListener" exists.
  1368  func HasFuncHasOnWriteProgress() bool {
  1369  	return js.True == bindings.HasFuncHasOnWriteProgress()
  1370  }
  1371  
  1372  // FuncHasOnWriteProgress returns the function "WEBEXT.imageWriterPrivate.onWriteProgress.hasListener".
  1373  func FuncHasOnWriteProgress() (fn js.Func[func(callback js.Func[func(info *ProgressInfo)]) bool]) {
  1374  	bindings.FuncHasOnWriteProgress(
  1375  		js.Pointer(&fn),
  1376  	)
  1377  	return
  1378  }
  1379  
  1380  // HasOnWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.hasListener" directly.
  1381  func HasOnWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret bool) {
  1382  	bindings.CallHasOnWriteProgress(
  1383  		js.Pointer(&ret),
  1384  		callback.Ref(),
  1385  	)
  1386  
  1387  	return
  1388  }
  1389  
  1390  // TryHasOnWriteProgress calls the function "WEBEXT.imageWriterPrivate.onWriteProgress.hasListener"
  1391  // in a try/catch block and returns (_, err, ok = false) when it went through
  1392  // the catch clause.
  1393  func TryHasOnWriteProgress(callback js.Func[func(info *ProgressInfo)]) (ret bool, exception js.Any, ok bool) {
  1394  	ok = js.True == bindings.TryHasOnWriteProgress(
  1395  		js.Pointer(&ret), js.Pointer(&exception),
  1396  		callback.Ref(),
  1397  	)
  1398  
  1399  	return
  1400  }
  1401  
  1402  // HasFuncWriteFromFile returns true if the function "WEBEXT.imageWriterPrivate.writeFromFile" exists.
  1403  func HasFuncWriteFromFile() bool {
  1404  	return js.True == bindings.HasFuncWriteFromFile()
  1405  }
  1406  
  1407  // FuncWriteFromFile returns the function "WEBEXT.imageWriterPrivate.writeFromFile".
  1408  func FuncWriteFromFile() (fn js.Func[func(storageUnitId js.String, fileEntry js.Object) js.Promise[js.Void]]) {
  1409  	bindings.FuncWriteFromFile(
  1410  		js.Pointer(&fn),
  1411  	)
  1412  	return
  1413  }
  1414  
  1415  // WriteFromFile calls the function "WEBEXT.imageWriterPrivate.writeFromFile" directly.
  1416  func WriteFromFile(storageUnitId js.String, fileEntry js.Object) (ret js.Promise[js.Void]) {
  1417  	bindings.CallWriteFromFile(
  1418  		js.Pointer(&ret),
  1419  		storageUnitId.Ref(),
  1420  		fileEntry.Ref(),
  1421  	)
  1422  
  1423  	return
  1424  }
  1425  
  1426  // TryWriteFromFile calls the function "WEBEXT.imageWriterPrivate.writeFromFile"
  1427  // in a try/catch block and returns (_, err, ok = false) when it went through
  1428  // the catch clause.
  1429  func TryWriteFromFile(storageUnitId js.String, fileEntry js.Object) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1430  	ok = js.True == bindings.TryWriteFromFile(
  1431  		js.Pointer(&ret), js.Pointer(&exception),
  1432  		storageUnitId.Ref(),
  1433  		fileEntry.Ref(),
  1434  	)
  1435  
  1436  	return
  1437  }
  1438  
  1439  // HasFuncWriteFromUrl returns true if the function "WEBEXT.imageWriterPrivate.writeFromUrl" exists.
  1440  func HasFuncWriteFromUrl() bool {
  1441  	return js.True == bindings.HasFuncWriteFromUrl()
  1442  }
  1443  
  1444  // FuncWriteFromUrl returns the function "WEBEXT.imageWriterPrivate.writeFromUrl".
  1445  func FuncWriteFromUrl() (fn js.Func[func(storageUnitId js.String, imageUrl js.String, options UrlWriteOptions) js.Promise[js.Void]]) {
  1446  	bindings.FuncWriteFromUrl(
  1447  		js.Pointer(&fn),
  1448  	)
  1449  	return
  1450  }
  1451  
  1452  // WriteFromUrl calls the function "WEBEXT.imageWriterPrivate.writeFromUrl" directly.
  1453  func WriteFromUrl(storageUnitId js.String, imageUrl js.String, options UrlWriteOptions) (ret js.Promise[js.Void]) {
  1454  	bindings.CallWriteFromUrl(
  1455  		js.Pointer(&ret),
  1456  		storageUnitId.Ref(),
  1457  		imageUrl.Ref(),
  1458  		js.Pointer(&options),
  1459  	)
  1460  
  1461  	return
  1462  }
  1463  
  1464  // TryWriteFromUrl calls the function "WEBEXT.imageWriterPrivate.writeFromUrl"
  1465  // in a try/catch block and returns (_, err, ok = false) when it went through
  1466  // the catch clause.
  1467  func TryWriteFromUrl(storageUnitId js.String, imageUrl js.String, options UrlWriteOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1468  	ok = js.True == bindings.TryWriteFromUrl(
  1469  		js.Pointer(&ret), js.Pointer(&exception),
  1470  		storageUnitId.Ref(),
  1471  		imageUrl.Ref(),
  1472  		js.Pointer(&options),
  1473  	)
  1474  
  1475  	return
  1476  }