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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package printerprovider
     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/printerprovider/bindings"
    11  	"github.com/primecitizens/pcz/std/plat/js/webext/usb"
    12  )
    13  
    14  type CapabilitiesCallbackFunc func(this js.Ref, capabilities js.Object) js.Ref
    15  
    16  func (fn CapabilitiesCallbackFunc) Register() js.Func[func(capabilities js.Object)] {
    17  	return js.RegisterCallback[func(capabilities js.Object)](
    18  		fn, abi.FuncPCABIInternal(fn),
    19  	)
    20  }
    21  
    22  func (fn CapabilitiesCallbackFunc) DispatchCallback(
    23  	targetPC uintptr, ctx *js.CallbackContext,
    24  ) {
    25  	args := ctx.Args()
    26  	if len(args) != 1+1 /* js this */ ||
    27  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    28  		js.ThrowInvalidCallbackInvocation()
    29  	}
    30  
    31  	if ctx.Return(fn(
    32  		args[0],
    33  
    34  		js.Object{}.FromRef(args[0+1]),
    35  	)) {
    36  		return
    37  	}
    38  
    39  	js.ThrowCallbackValueNotReturned()
    40  }
    41  
    42  type CapabilitiesCallback[T any] struct {
    43  	Fn  func(arg T, this js.Ref, capabilities js.Object) js.Ref
    44  	Arg T
    45  }
    46  
    47  func (cb *CapabilitiesCallback[T]) Register() js.Func[func(capabilities js.Object)] {
    48  	return js.RegisterCallback[func(capabilities js.Object)](
    49  		cb, abi.FuncPCABIInternal(cb.Fn),
    50  	)
    51  }
    52  
    53  func (cb *CapabilitiesCallback[T]) DispatchCallback(
    54  	targetPC uintptr, ctx *js.CallbackContext,
    55  ) {
    56  	args := ctx.Args()
    57  	if len(args) != 1+1 /* js this */ ||
    58  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
    59  		js.ThrowInvalidCallbackInvocation()
    60  	}
    61  
    62  	if ctx.Return(cb.Fn(
    63  		cb.Arg,
    64  		args[0],
    65  
    66  		js.Object{}.FromRef(args[0+1]),
    67  	)) {
    68  		return
    69  	}
    70  
    71  	js.ThrowCallbackValueNotReturned()
    72  }
    73  
    74  type PrintCallbackFunc func(this js.Ref, result PrintError) js.Ref
    75  
    76  func (fn PrintCallbackFunc) Register() js.Func[func(result PrintError)] {
    77  	return js.RegisterCallback[func(result PrintError)](
    78  		fn, abi.FuncPCABIInternal(fn),
    79  	)
    80  }
    81  
    82  func (fn PrintCallbackFunc) DispatchCallback(
    83  	targetPC uintptr, ctx *js.CallbackContext,
    84  ) {
    85  	args := ctx.Args()
    86  	if len(args) != 1+1 /* js this */ ||
    87  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    88  		js.ThrowInvalidCallbackInvocation()
    89  	}
    90  
    91  	if ctx.Return(fn(
    92  		args[0],
    93  
    94  		PrintError(0).FromRef(args[0+1]),
    95  	)) {
    96  		return
    97  	}
    98  
    99  	js.ThrowCallbackValueNotReturned()
   100  }
   101  
   102  type PrintCallback[T any] struct {
   103  	Fn  func(arg T, this js.Ref, result PrintError) js.Ref
   104  	Arg T
   105  }
   106  
   107  func (cb *PrintCallback[T]) Register() js.Func[func(result PrintError)] {
   108  	return js.RegisterCallback[func(result PrintError)](
   109  		cb, abi.FuncPCABIInternal(cb.Fn),
   110  	)
   111  }
   112  
   113  func (cb *PrintCallback[T]) DispatchCallback(
   114  	targetPC uintptr, ctx *js.CallbackContext,
   115  ) {
   116  	args := ctx.Args()
   117  	if len(args) != 1+1 /* js this */ ||
   118  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   119  		js.ThrowInvalidCallbackInvocation()
   120  	}
   121  
   122  	if ctx.Return(cb.Fn(
   123  		cb.Arg,
   124  		args[0],
   125  
   126  		PrintError(0).FromRef(args[0+1]),
   127  	)) {
   128  		return
   129  	}
   130  
   131  	js.ThrowCallbackValueNotReturned()
   132  }
   133  
   134  type PrintError uint32
   135  
   136  const (
   137  	_ PrintError = iota
   138  
   139  	PrintError_OK
   140  	PrintError_FAILED
   141  	PrintError_INVALID_TICKET
   142  	PrintError_INVALID_DATA
   143  )
   144  
   145  func (PrintError) FromRef(str js.Ref) PrintError {
   146  	return PrintError(bindings.ConstOfPrintError(str))
   147  }
   148  
   149  func (x PrintError) String() (string, bool) {
   150  	switch x {
   151  	case PrintError_OK:
   152  		return "OK", true
   153  	case PrintError_FAILED:
   154  		return "FAILED", true
   155  	case PrintError_INVALID_TICKET:
   156  		return "INVALID_TICKET", true
   157  	case PrintError_INVALID_DATA:
   158  		return "INVALID_DATA", true
   159  	default:
   160  		return "", false
   161  	}
   162  }
   163  
   164  type PrintJob struct {
   165  	// PrinterId is "PrintJob.printerId"
   166  	//
   167  	// Optional
   168  	PrinterId js.String
   169  	// Title is "PrintJob.title"
   170  	//
   171  	// Optional
   172  	Title js.String
   173  	// Ticket is "PrintJob.ticket"
   174  	//
   175  	// Optional
   176  	Ticket js.Object
   177  	// ContentType is "PrintJob.contentType"
   178  	//
   179  	// Optional
   180  	ContentType js.String
   181  	// Document is "PrintJob.document"
   182  	//
   183  	// Optional
   184  	Document js.Object
   185  
   186  	FFI_USE bool
   187  }
   188  
   189  // FromRef calls UpdateFrom and returns a PrintJob with all fields set.
   190  func (p PrintJob) FromRef(ref js.Ref) PrintJob {
   191  	p.UpdateFrom(ref)
   192  	return p
   193  }
   194  
   195  // New creates a new PrintJob in the application heap.
   196  func (p PrintJob) New() js.Ref {
   197  	return bindings.PrintJobJSLoad(
   198  		js.Pointer(&p), js.True, 0,
   199  	)
   200  }
   201  
   202  // UpdateFrom copies value of all fields of the heap object to p.
   203  func (p *PrintJob) UpdateFrom(ref js.Ref) {
   204  	bindings.PrintJobJSStore(
   205  		js.Pointer(p), ref,
   206  	)
   207  }
   208  
   209  // Update writes all fields of the p to the heap object referenced by ref.
   210  func (p *PrintJob) Update(ref js.Ref) {
   211  	bindings.PrintJobJSLoad(
   212  		js.Pointer(p), js.False, ref,
   213  	)
   214  }
   215  
   216  // FreeMembers frees fields with heap reference, if recursive is true
   217  // free all heap references reachable from p.
   218  func (p *PrintJob) FreeMembers(recursive bool) {
   219  	js.Free(
   220  		p.PrinterId.Ref(),
   221  		p.Title.Ref(),
   222  		p.Ticket.Ref(),
   223  		p.ContentType.Ref(),
   224  		p.Document.Ref(),
   225  	)
   226  	p.PrinterId = p.PrinterId.FromRef(js.Undefined)
   227  	p.Title = p.Title.FromRef(js.Undefined)
   228  	p.Ticket = p.Ticket.FromRef(js.Undefined)
   229  	p.ContentType = p.ContentType.FromRef(js.Undefined)
   230  	p.Document = p.Document.FromRef(js.Undefined)
   231  }
   232  
   233  type PrinterInfo struct {
   234  	// Id is "PrinterInfo.id"
   235  	//
   236  	// Optional
   237  	Id js.String
   238  	// Name is "PrinterInfo.name"
   239  	//
   240  	// Optional
   241  	Name js.String
   242  	// Description is "PrinterInfo.description"
   243  	//
   244  	// Optional
   245  	Description js.String
   246  
   247  	FFI_USE bool
   248  }
   249  
   250  // FromRef calls UpdateFrom and returns a PrinterInfo with all fields set.
   251  func (p PrinterInfo) FromRef(ref js.Ref) PrinterInfo {
   252  	p.UpdateFrom(ref)
   253  	return p
   254  }
   255  
   256  // New creates a new PrinterInfo in the application heap.
   257  func (p PrinterInfo) New() js.Ref {
   258  	return bindings.PrinterInfoJSLoad(
   259  		js.Pointer(&p), js.True, 0,
   260  	)
   261  }
   262  
   263  // UpdateFrom copies value of all fields of the heap object to p.
   264  func (p *PrinterInfo) UpdateFrom(ref js.Ref) {
   265  	bindings.PrinterInfoJSStore(
   266  		js.Pointer(p), ref,
   267  	)
   268  }
   269  
   270  // Update writes all fields of the p to the heap object referenced by ref.
   271  func (p *PrinterInfo) Update(ref js.Ref) {
   272  	bindings.PrinterInfoJSLoad(
   273  		js.Pointer(p), js.False, ref,
   274  	)
   275  }
   276  
   277  // FreeMembers frees fields with heap reference, if recursive is true
   278  // free all heap references reachable from p.
   279  func (p *PrinterInfo) FreeMembers(recursive bool) {
   280  	js.Free(
   281  		p.Id.Ref(),
   282  		p.Name.Ref(),
   283  		p.Description.Ref(),
   284  	)
   285  	p.Id = p.Id.FromRef(js.Undefined)
   286  	p.Name = p.Name.FromRef(js.Undefined)
   287  	p.Description = p.Description.FromRef(js.Undefined)
   288  }
   289  
   290  type PrinterInfoCallbackFunc func(this js.Ref, printerInfo *PrinterInfo) js.Ref
   291  
   292  func (fn PrinterInfoCallbackFunc) Register() js.Func[func(printerInfo *PrinterInfo)] {
   293  	return js.RegisterCallback[func(printerInfo *PrinterInfo)](
   294  		fn, abi.FuncPCABIInternal(fn),
   295  	)
   296  }
   297  
   298  func (fn PrinterInfoCallbackFunc) DispatchCallback(
   299  	targetPC uintptr, ctx *js.CallbackContext,
   300  ) {
   301  	args := ctx.Args()
   302  	if len(args) != 1+1 /* js this */ ||
   303  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   304  		js.ThrowInvalidCallbackInvocation()
   305  	}
   306  	var arg0 PrinterInfo
   307  	arg0.UpdateFrom(args[0+1])
   308  	defer arg0.FreeMembers(true)
   309  
   310  	if ctx.Return(fn(
   311  		args[0],
   312  
   313  		mark.NoEscape(&arg0),
   314  	)) {
   315  		return
   316  	}
   317  
   318  	js.ThrowCallbackValueNotReturned()
   319  }
   320  
   321  type PrinterInfoCallback[T any] struct {
   322  	Fn  func(arg T, this js.Ref, printerInfo *PrinterInfo) js.Ref
   323  	Arg T
   324  }
   325  
   326  func (cb *PrinterInfoCallback[T]) Register() js.Func[func(printerInfo *PrinterInfo)] {
   327  	return js.RegisterCallback[func(printerInfo *PrinterInfo)](
   328  		cb, abi.FuncPCABIInternal(cb.Fn),
   329  	)
   330  }
   331  
   332  func (cb *PrinterInfoCallback[T]) DispatchCallback(
   333  	targetPC uintptr, ctx *js.CallbackContext,
   334  ) {
   335  	args := ctx.Args()
   336  	if len(args) != 1+1 /* js this */ ||
   337  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   338  		js.ThrowInvalidCallbackInvocation()
   339  	}
   340  	var arg0 PrinterInfo
   341  	arg0.UpdateFrom(args[0+1])
   342  	defer arg0.FreeMembers(true)
   343  
   344  	if ctx.Return(cb.Fn(
   345  		cb.Arg,
   346  		args[0],
   347  
   348  		mark.NoEscape(&arg0),
   349  	)) {
   350  		return
   351  	}
   352  
   353  	js.ThrowCallbackValueNotReturned()
   354  }
   355  
   356  type PrintersCallbackFunc func(this js.Ref, printerInfo js.Array[PrinterInfo]) js.Ref
   357  
   358  func (fn PrintersCallbackFunc) Register() js.Func[func(printerInfo js.Array[PrinterInfo])] {
   359  	return js.RegisterCallback[func(printerInfo js.Array[PrinterInfo])](
   360  		fn, abi.FuncPCABIInternal(fn),
   361  	)
   362  }
   363  
   364  func (fn PrintersCallbackFunc) DispatchCallback(
   365  	targetPC uintptr, ctx *js.CallbackContext,
   366  ) {
   367  	args := ctx.Args()
   368  	if len(args) != 1+1 /* js this */ ||
   369  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   370  		js.ThrowInvalidCallbackInvocation()
   371  	}
   372  
   373  	if ctx.Return(fn(
   374  		args[0],
   375  
   376  		js.Array[PrinterInfo]{}.FromRef(args[0+1]),
   377  	)) {
   378  		return
   379  	}
   380  
   381  	js.ThrowCallbackValueNotReturned()
   382  }
   383  
   384  type PrintersCallback[T any] struct {
   385  	Fn  func(arg T, this js.Ref, printerInfo js.Array[PrinterInfo]) js.Ref
   386  	Arg T
   387  }
   388  
   389  func (cb *PrintersCallback[T]) Register() js.Func[func(printerInfo js.Array[PrinterInfo])] {
   390  	return js.RegisterCallback[func(printerInfo js.Array[PrinterInfo])](
   391  		cb, abi.FuncPCABIInternal(cb.Fn),
   392  	)
   393  }
   394  
   395  func (cb *PrintersCallback[T]) DispatchCallback(
   396  	targetPC uintptr, ctx *js.CallbackContext,
   397  ) {
   398  	args := ctx.Args()
   399  	if len(args) != 1+1 /* js this */ ||
   400  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   401  		js.ThrowInvalidCallbackInvocation()
   402  	}
   403  
   404  	if ctx.Return(cb.Fn(
   405  		cb.Arg,
   406  		args[0],
   407  
   408  		js.Array[PrinterInfo]{}.FromRef(args[0+1]),
   409  	)) {
   410  		return
   411  	}
   412  
   413  	js.ThrowCallbackValueNotReturned()
   414  }
   415  
   416  type OnGetCapabilityRequestedEventCallbackFunc func(this js.Ref, printerId js.String, resultCallback js.Func[func(capabilities js.Object)]) js.Ref
   417  
   418  func (fn OnGetCapabilityRequestedEventCallbackFunc) Register() js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])] {
   419  	return js.RegisterCallback[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])](
   420  		fn, abi.FuncPCABIInternal(fn),
   421  	)
   422  }
   423  
   424  func (fn OnGetCapabilityRequestedEventCallbackFunc) DispatchCallback(
   425  	targetPC uintptr, ctx *js.CallbackContext,
   426  ) {
   427  	args := ctx.Args()
   428  	if len(args) != 2+1 /* js this */ ||
   429  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   430  		js.ThrowInvalidCallbackInvocation()
   431  	}
   432  
   433  	if ctx.Return(fn(
   434  		args[0],
   435  
   436  		js.String{}.FromRef(args[0+1]),
   437  		js.Func[func(capabilities js.Object)]{}.FromRef(args[1+1]),
   438  	)) {
   439  		return
   440  	}
   441  
   442  	js.ThrowCallbackValueNotReturned()
   443  }
   444  
   445  type OnGetCapabilityRequestedEventCallback[T any] struct {
   446  	Fn  func(arg T, this js.Ref, printerId js.String, resultCallback js.Func[func(capabilities js.Object)]) js.Ref
   447  	Arg T
   448  }
   449  
   450  func (cb *OnGetCapabilityRequestedEventCallback[T]) Register() js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])] {
   451  	return js.RegisterCallback[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])](
   452  		cb, abi.FuncPCABIInternal(cb.Fn),
   453  	)
   454  }
   455  
   456  func (cb *OnGetCapabilityRequestedEventCallback[T]) DispatchCallback(
   457  	targetPC uintptr, ctx *js.CallbackContext,
   458  ) {
   459  	args := ctx.Args()
   460  	if len(args) != 2+1 /* js this */ ||
   461  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   462  		js.ThrowInvalidCallbackInvocation()
   463  	}
   464  
   465  	if ctx.Return(cb.Fn(
   466  		cb.Arg,
   467  		args[0],
   468  
   469  		js.String{}.FromRef(args[0+1]),
   470  		js.Func[func(capabilities js.Object)]{}.FromRef(args[1+1]),
   471  	)) {
   472  		return
   473  	}
   474  
   475  	js.ThrowCallbackValueNotReturned()
   476  }
   477  
   478  // HasFuncOnGetCapabilityRequested returns true if the function "WEBEXT.printerProvider.onGetCapabilityRequested.addListener" exists.
   479  func HasFuncOnGetCapabilityRequested() bool {
   480  	return js.True == bindings.HasFuncOnGetCapabilityRequested()
   481  }
   482  
   483  // FuncOnGetCapabilityRequested returns the function "WEBEXT.printerProvider.onGetCapabilityRequested.addListener".
   484  func FuncOnGetCapabilityRequested() (fn js.Func[func(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])])]) {
   485  	bindings.FuncOnGetCapabilityRequested(
   486  		js.Pointer(&fn),
   487  	)
   488  	return
   489  }
   490  
   491  // OnGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.addListener" directly.
   492  func OnGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret js.Void) {
   493  	bindings.CallOnGetCapabilityRequested(
   494  		js.Pointer(&ret),
   495  		callback.Ref(),
   496  	)
   497  
   498  	return
   499  }
   500  
   501  // TryOnGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.addListener"
   502  // in a try/catch block and returns (_, err, ok = false) when it went through
   503  // the catch clause.
   504  func TryOnGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret js.Void, exception js.Any, ok bool) {
   505  	ok = js.True == bindings.TryOnGetCapabilityRequested(
   506  		js.Pointer(&ret), js.Pointer(&exception),
   507  		callback.Ref(),
   508  	)
   509  
   510  	return
   511  }
   512  
   513  // HasFuncOffGetCapabilityRequested returns true if the function "WEBEXT.printerProvider.onGetCapabilityRequested.removeListener" exists.
   514  func HasFuncOffGetCapabilityRequested() bool {
   515  	return js.True == bindings.HasFuncOffGetCapabilityRequested()
   516  }
   517  
   518  // FuncOffGetCapabilityRequested returns the function "WEBEXT.printerProvider.onGetCapabilityRequested.removeListener".
   519  func FuncOffGetCapabilityRequested() (fn js.Func[func(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])])]) {
   520  	bindings.FuncOffGetCapabilityRequested(
   521  		js.Pointer(&fn),
   522  	)
   523  	return
   524  }
   525  
   526  // OffGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.removeListener" directly.
   527  func OffGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret js.Void) {
   528  	bindings.CallOffGetCapabilityRequested(
   529  		js.Pointer(&ret),
   530  		callback.Ref(),
   531  	)
   532  
   533  	return
   534  }
   535  
   536  // TryOffGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.removeListener"
   537  // in a try/catch block and returns (_, err, ok = false) when it went through
   538  // the catch clause.
   539  func TryOffGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret js.Void, exception js.Any, ok bool) {
   540  	ok = js.True == bindings.TryOffGetCapabilityRequested(
   541  		js.Pointer(&ret), js.Pointer(&exception),
   542  		callback.Ref(),
   543  	)
   544  
   545  	return
   546  }
   547  
   548  // HasFuncHasOnGetCapabilityRequested returns true if the function "WEBEXT.printerProvider.onGetCapabilityRequested.hasListener" exists.
   549  func HasFuncHasOnGetCapabilityRequested() bool {
   550  	return js.True == bindings.HasFuncHasOnGetCapabilityRequested()
   551  }
   552  
   553  // FuncHasOnGetCapabilityRequested returns the function "WEBEXT.printerProvider.onGetCapabilityRequested.hasListener".
   554  func FuncHasOnGetCapabilityRequested() (fn js.Func[func(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) bool]) {
   555  	bindings.FuncHasOnGetCapabilityRequested(
   556  		js.Pointer(&fn),
   557  	)
   558  	return
   559  }
   560  
   561  // HasOnGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.hasListener" directly.
   562  func HasOnGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret bool) {
   563  	bindings.CallHasOnGetCapabilityRequested(
   564  		js.Pointer(&ret),
   565  		callback.Ref(),
   566  	)
   567  
   568  	return
   569  }
   570  
   571  // TryHasOnGetCapabilityRequested calls the function "WEBEXT.printerProvider.onGetCapabilityRequested.hasListener"
   572  // in a try/catch block and returns (_, err, ok = false) when it went through
   573  // the catch clause.
   574  func TryHasOnGetCapabilityRequested(callback js.Func[func(printerId js.String, resultCallback js.Func[func(capabilities js.Object)])]) (ret bool, exception js.Any, ok bool) {
   575  	ok = js.True == bindings.TryHasOnGetCapabilityRequested(
   576  		js.Pointer(&ret), js.Pointer(&exception),
   577  		callback.Ref(),
   578  	)
   579  
   580  	return
   581  }
   582  
   583  type OnGetPrintersRequestedEventCallbackFunc func(this js.Ref, resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])]) js.Ref
   584  
   585  func (fn OnGetPrintersRequestedEventCallbackFunc) Register() js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])] {
   586  	return js.RegisterCallback[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])](
   587  		fn, abi.FuncPCABIInternal(fn),
   588  	)
   589  }
   590  
   591  func (fn OnGetPrintersRequestedEventCallbackFunc) DispatchCallback(
   592  	targetPC uintptr, ctx *js.CallbackContext,
   593  ) {
   594  	args := ctx.Args()
   595  	if len(args) != 1+1 /* js this */ ||
   596  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   597  		js.ThrowInvalidCallbackInvocation()
   598  	}
   599  
   600  	if ctx.Return(fn(
   601  		args[0],
   602  
   603  		js.Func[func(printerInfo js.Array[PrinterInfo])]{}.FromRef(args[0+1]),
   604  	)) {
   605  		return
   606  	}
   607  
   608  	js.ThrowCallbackValueNotReturned()
   609  }
   610  
   611  type OnGetPrintersRequestedEventCallback[T any] struct {
   612  	Fn  func(arg T, this js.Ref, resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])]) js.Ref
   613  	Arg T
   614  }
   615  
   616  func (cb *OnGetPrintersRequestedEventCallback[T]) Register() js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])] {
   617  	return js.RegisterCallback[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])](
   618  		cb, abi.FuncPCABIInternal(cb.Fn),
   619  	)
   620  }
   621  
   622  func (cb *OnGetPrintersRequestedEventCallback[T]) DispatchCallback(
   623  	targetPC uintptr, ctx *js.CallbackContext,
   624  ) {
   625  	args := ctx.Args()
   626  	if len(args) != 1+1 /* js this */ ||
   627  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   628  		js.ThrowInvalidCallbackInvocation()
   629  	}
   630  
   631  	if ctx.Return(cb.Fn(
   632  		cb.Arg,
   633  		args[0],
   634  
   635  		js.Func[func(printerInfo js.Array[PrinterInfo])]{}.FromRef(args[0+1]),
   636  	)) {
   637  		return
   638  	}
   639  
   640  	js.ThrowCallbackValueNotReturned()
   641  }
   642  
   643  // HasFuncOnGetPrintersRequested returns true if the function "WEBEXT.printerProvider.onGetPrintersRequested.addListener" exists.
   644  func HasFuncOnGetPrintersRequested() bool {
   645  	return js.True == bindings.HasFuncOnGetPrintersRequested()
   646  }
   647  
   648  // FuncOnGetPrintersRequested returns the function "WEBEXT.printerProvider.onGetPrintersRequested.addListener".
   649  func FuncOnGetPrintersRequested() (fn js.Func[func(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])])]) {
   650  	bindings.FuncOnGetPrintersRequested(
   651  		js.Pointer(&fn),
   652  	)
   653  	return
   654  }
   655  
   656  // OnGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.addListener" directly.
   657  func OnGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret js.Void) {
   658  	bindings.CallOnGetPrintersRequested(
   659  		js.Pointer(&ret),
   660  		callback.Ref(),
   661  	)
   662  
   663  	return
   664  }
   665  
   666  // TryOnGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.addListener"
   667  // in a try/catch block and returns (_, err, ok = false) when it went through
   668  // the catch clause.
   669  func TryOnGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret js.Void, exception js.Any, ok bool) {
   670  	ok = js.True == bindings.TryOnGetPrintersRequested(
   671  		js.Pointer(&ret), js.Pointer(&exception),
   672  		callback.Ref(),
   673  	)
   674  
   675  	return
   676  }
   677  
   678  // HasFuncOffGetPrintersRequested returns true if the function "WEBEXT.printerProvider.onGetPrintersRequested.removeListener" exists.
   679  func HasFuncOffGetPrintersRequested() bool {
   680  	return js.True == bindings.HasFuncOffGetPrintersRequested()
   681  }
   682  
   683  // FuncOffGetPrintersRequested returns the function "WEBEXT.printerProvider.onGetPrintersRequested.removeListener".
   684  func FuncOffGetPrintersRequested() (fn js.Func[func(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])])]) {
   685  	bindings.FuncOffGetPrintersRequested(
   686  		js.Pointer(&fn),
   687  	)
   688  	return
   689  }
   690  
   691  // OffGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.removeListener" directly.
   692  func OffGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret js.Void) {
   693  	bindings.CallOffGetPrintersRequested(
   694  		js.Pointer(&ret),
   695  		callback.Ref(),
   696  	)
   697  
   698  	return
   699  }
   700  
   701  // TryOffGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.removeListener"
   702  // in a try/catch block and returns (_, err, ok = false) when it went through
   703  // the catch clause.
   704  func TryOffGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret js.Void, exception js.Any, ok bool) {
   705  	ok = js.True == bindings.TryOffGetPrintersRequested(
   706  		js.Pointer(&ret), js.Pointer(&exception),
   707  		callback.Ref(),
   708  	)
   709  
   710  	return
   711  }
   712  
   713  // HasFuncHasOnGetPrintersRequested returns true if the function "WEBEXT.printerProvider.onGetPrintersRequested.hasListener" exists.
   714  func HasFuncHasOnGetPrintersRequested() bool {
   715  	return js.True == bindings.HasFuncHasOnGetPrintersRequested()
   716  }
   717  
   718  // FuncHasOnGetPrintersRequested returns the function "WEBEXT.printerProvider.onGetPrintersRequested.hasListener".
   719  func FuncHasOnGetPrintersRequested() (fn js.Func[func(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) bool]) {
   720  	bindings.FuncHasOnGetPrintersRequested(
   721  		js.Pointer(&fn),
   722  	)
   723  	return
   724  }
   725  
   726  // HasOnGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.hasListener" directly.
   727  func HasOnGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret bool) {
   728  	bindings.CallHasOnGetPrintersRequested(
   729  		js.Pointer(&ret),
   730  		callback.Ref(),
   731  	)
   732  
   733  	return
   734  }
   735  
   736  // TryHasOnGetPrintersRequested calls the function "WEBEXT.printerProvider.onGetPrintersRequested.hasListener"
   737  // in a try/catch block and returns (_, err, ok = false) when it went through
   738  // the catch clause.
   739  func TryHasOnGetPrintersRequested(callback js.Func[func(resultCallback js.Func[func(printerInfo js.Array[PrinterInfo])])]) (ret bool, exception js.Any, ok bool) {
   740  	ok = js.True == bindings.TryHasOnGetPrintersRequested(
   741  		js.Pointer(&ret), js.Pointer(&exception),
   742  		callback.Ref(),
   743  	)
   744  
   745  	return
   746  }
   747  
   748  type OnGetUsbPrinterInfoRequestedEventCallbackFunc func(this js.Ref, device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)]) js.Ref
   749  
   750  func (fn OnGetUsbPrinterInfoRequestedEventCallbackFunc) Register() js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])] {
   751  	return js.RegisterCallback[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])](
   752  		fn, abi.FuncPCABIInternal(fn),
   753  	)
   754  }
   755  
   756  func (fn OnGetUsbPrinterInfoRequestedEventCallbackFunc) DispatchCallback(
   757  	targetPC uintptr, ctx *js.CallbackContext,
   758  ) {
   759  	args := ctx.Args()
   760  	if len(args) != 2+1 /* js this */ ||
   761  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   762  		js.ThrowInvalidCallbackInvocation()
   763  	}
   764  	var arg0 usb.Device
   765  	arg0.UpdateFrom(args[0+1])
   766  	defer arg0.FreeMembers(true)
   767  
   768  	if ctx.Return(fn(
   769  		args[0],
   770  
   771  		mark.NoEscape(&arg0),
   772  		js.Func[func(printerInfo *PrinterInfo)]{}.FromRef(args[1+1]),
   773  	)) {
   774  		return
   775  	}
   776  
   777  	js.ThrowCallbackValueNotReturned()
   778  }
   779  
   780  type OnGetUsbPrinterInfoRequestedEventCallback[T any] struct {
   781  	Fn  func(arg T, this js.Ref, device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)]) js.Ref
   782  	Arg T
   783  }
   784  
   785  func (cb *OnGetUsbPrinterInfoRequestedEventCallback[T]) Register() js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])] {
   786  	return js.RegisterCallback[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])](
   787  		cb, abi.FuncPCABIInternal(cb.Fn),
   788  	)
   789  }
   790  
   791  func (cb *OnGetUsbPrinterInfoRequestedEventCallback[T]) DispatchCallback(
   792  	targetPC uintptr, ctx *js.CallbackContext,
   793  ) {
   794  	args := ctx.Args()
   795  	if len(args) != 2+1 /* js this */ ||
   796  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   797  		js.ThrowInvalidCallbackInvocation()
   798  	}
   799  	var arg0 usb.Device
   800  	arg0.UpdateFrom(args[0+1])
   801  	defer arg0.FreeMembers(true)
   802  
   803  	if ctx.Return(cb.Fn(
   804  		cb.Arg,
   805  		args[0],
   806  
   807  		mark.NoEscape(&arg0),
   808  		js.Func[func(printerInfo *PrinterInfo)]{}.FromRef(args[1+1]),
   809  	)) {
   810  		return
   811  	}
   812  
   813  	js.ThrowCallbackValueNotReturned()
   814  }
   815  
   816  // HasFuncOnGetUsbPrinterInfoRequested returns true if the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.addListener" exists.
   817  func HasFuncOnGetUsbPrinterInfoRequested() bool {
   818  	return js.True == bindings.HasFuncOnGetUsbPrinterInfoRequested()
   819  }
   820  
   821  // FuncOnGetUsbPrinterInfoRequested returns the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.addListener".
   822  func FuncOnGetUsbPrinterInfoRequested() (fn js.Func[func(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])])]) {
   823  	bindings.FuncOnGetUsbPrinterInfoRequested(
   824  		js.Pointer(&fn),
   825  	)
   826  	return
   827  }
   828  
   829  // OnGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.addListener" directly.
   830  func OnGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret js.Void) {
   831  	bindings.CallOnGetUsbPrinterInfoRequested(
   832  		js.Pointer(&ret),
   833  		callback.Ref(),
   834  	)
   835  
   836  	return
   837  }
   838  
   839  // TryOnGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.addListener"
   840  // in a try/catch block and returns (_, err, ok = false) when it went through
   841  // the catch clause.
   842  func TryOnGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret js.Void, exception js.Any, ok bool) {
   843  	ok = js.True == bindings.TryOnGetUsbPrinterInfoRequested(
   844  		js.Pointer(&ret), js.Pointer(&exception),
   845  		callback.Ref(),
   846  	)
   847  
   848  	return
   849  }
   850  
   851  // HasFuncOffGetUsbPrinterInfoRequested returns true if the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.removeListener" exists.
   852  func HasFuncOffGetUsbPrinterInfoRequested() bool {
   853  	return js.True == bindings.HasFuncOffGetUsbPrinterInfoRequested()
   854  }
   855  
   856  // FuncOffGetUsbPrinterInfoRequested returns the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.removeListener".
   857  func FuncOffGetUsbPrinterInfoRequested() (fn js.Func[func(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])])]) {
   858  	bindings.FuncOffGetUsbPrinterInfoRequested(
   859  		js.Pointer(&fn),
   860  	)
   861  	return
   862  }
   863  
   864  // OffGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.removeListener" directly.
   865  func OffGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret js.Void) {
   866  	bindings.CallOffGetUsbPrinterInfoRequested(
   867  		js.Pointer(&ret),
   868  		callback.Ref(),
   869  	)
   870  
   871  	return
   872  }
   873  
   874  // TryOffGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.removeListener"
   875  // in a try/catch block and returns (_, err, ok = false) when it went through
   876  // the catch clause.
   877  func TryOffGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret js.Void, exception js.Any, ok bool) {
   878  	ok = js.True == bindings.TryOffGetUsbPrinterInfoRequested(
   879  		js.Pointer(&ret), js.Pointer(&exception),
   880  		callback.Ref(),
   881  	)
   882  
   883  	return
   884  }
   885  
   886  // HasFuncHasOnGetUsbPrinterInfoRequested returns true if the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.hasListener" exists.
   887  func HasFuncHasOnGetUsbPrinterInfoRequested() bool {
   888  	return js.True == bindings.HasFuncHasOnGetUsbPrinterInfoRequested()
   889  }
   890  
   891  // FuncHasOnGetUsbPrinterInfoRequested returns the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.hasListener".
   892  func FuncHasOnGetUsbPrinterInfoRequested() (fn js.Func[func(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) bool]) {
   893  	bindings.FuncHasOnGetUsbPrinterInfoRequested(
   894  		js.Pointer(&fn),
   895  	)
   896  	return
   897  }
   898  
   899  // HasOnGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.hasListener" directly.
   900  func HasOnGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret bool) {
   901  	bindings.CallHasOnGetUsbPrinterInfoRequested(
   902  		js.Pointer(&ret),
   903  		callback.Ref(),
   904  	)
   905  
   906  	return
   907  }
   908  
   909  // TryHasOnGetUsbPrinterInfoRequested calls the function "WEBEXT.printerProvider.onGetUsbPrinterInfoRequested.hasListener"
   910  // in a try/catch block and returns (_, err, ok = false) when it went through
   911  // the catch clause.
   912  func TryHasOnGetUsbPrinterInfoRequested(callback js.Func[func(device *usb.Device, resultCallback js.Func[func(printerInfo *PrinterInfo)])]) (ret bool, exception js.Any, ok bool) {
   913  	ok = js.True == bindings.TryHasOnGetUsbPrinterInfoRequested(
   914  		js.Pointer(&ret), js.Pointer(&exception),
   915  		callback.Ref(),
   916  	)
   917  
   918  	return
   919  }
   920  
   921  type OnPrintRequestedEventCallbackFunc func(this js.Ref, printJob *PrintJob, resultCallback js.Func[func(result PrintError)]) js.Ref
   922  
   923  func (fn OnPrintRequestedEventCallbackFunc) Register() js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])] {
   924  	return js.RegisterCallback[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])](
   925  		fn, abi.FuncPCABIInternal(fn),
   926  	)
   927  }
   928  
   929  func (fn OnPrintRequestedEventCallbackFunc) DispatchCallback(
   930  	targetPC uintptr, ctx *js.CallbackContext,
   931  ) {
   932  	args := ctx.Args()
   933  	if len(args) != 2+1 /* js this */ ||
   934  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   935  		js.ThrowInvalidCallbackInvocation()
   936  	}
   937  	var arg0 PrintJob
   938  	arg0.UpdateFrom(args[0+1])
   939  	defer arg0.FreeMembers(true)
   940  
   941  	if ctx.Return(fn(
   942  		args[0],
   943  
   944  		mark.NoEscape(&arg0),
   945  		js.Func[func(result PrintError)]{}.FromRef(args[1+1]),
   946  	)) {
   947  		return
   948  	}
   949  
   950  	js.ThrowCallbackValueNotReturned()
   951  }
   952  
   953  type OnPrintRequestedEventCallback[T any] struct {
   954  	Fn  func(arg T, this js.Ref, printJob *PrintJob, resultCallback js.Func[func(result PrintError)]) js.Ref
   955  	Arg T
   956  }
   957  
   958  func (cb *OnPrintRequestedEventCallback[T]) Register() js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])] {
   959  	return js.RegisterCallback[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])](
   960  		cb, abi.FuncPCABIInternal(cb.Fn),
   961  	)
   962  }
   963  
   964  func (cb *OnPrintRequestedEventCallback[T]) DispatchCallback(
   965  	targetPC uintptr, ctx *js.CallbackContext,
   966  ) {
   967  	args := ctx.Args()
   968  	if len(args) != 2+1 /* js this */ ||
   969  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   970  		js.ThrowInvalidCallbackInvocation()
   971  	}
   972  	var arg0 PrintJob
   973  	arg0.UpdateFrom(args[0+1])
   974  	defer arg0.FreeMembers(true)
   975  
   976  	if ctx.Return(cb.Fn(
   977  		cb.Arg,
   978  		args[0],
   979  
   980  		mark.NoEscape(&arg0),
   981  		js.Func[func(result PrintError)]{}.FromRef(args[1+1]),
   982  	)) {
   983  		return
   984  	}
   985  
   986  	js.ThrowCallbackValueNotReturned()
   987  }
   988  
   989  // HasFuncOnPrintRequested returns true if the function "WEBEXT.printerProvider.onPrintRequested.addListener" exists.
   990  func HasFuncOnPrintRequested() bool {
   991  	return js.True == bindings.HasFuncOnPrintRequested()
   992  }
   993  
   994  // FuncOnPrintRequested returns the function "WEBEXT.printerProvider.onPrintRequested.addListener".
   995  func FuncOnPrintRequested() (fn js.Func[func(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])])]) {
   996  	bindings.FuncOnPrintRequested(
   997  		js.Pointer(&fn),
   998  	)
   999  	return
  1000  }
  1001  
  1002  // OnPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.addListener" directly.
  1003  func OnPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret js.Void) {
  1004  	bindings.CallOnPrintRequested(
  1005  		js.Pointer(&ret),
  1006  		callback.Ref(),
  1007  	)
  1008  
  1009  	return
  1010  }
  1011  
  1012  // TryOnPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.addListener"
  1013  // in a try/catch block and returns (_, err, ok = false) when it went through
  1014  // the catch clause.
  1015  func TryOnPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret js.Void, exception js.Any, ok bool) {
  1016  	ok = js.True == bindings.TryOnPrintRequested(
  1017  		js.Pointer(&ret), js.Pointer(&exception),
  1018  		callback.Ref(),
  1019  	)
  1020  
  1021  	return
  1022  }
  1023  
  1024  // HasFuncOffPrintRequested returns true if the function "WEBEXT.printerProvider.onPrintRequested.removeListener" exists.
  1025  func HasFuncOffPrintRequested() bool {
  1026  	return js.True == bindings.HasFuncOffPrintRequested()
  1027  }
  1028  
  1029  // FuncOffPrintRequested returns the function "WEBEXT.printerProvider.onPrintRequested.removeListener".
  1030  func FuncOffPrintRequested() (fn js.Func[func(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])])]) {
  1031  	bindings.FuncOffPrintRequested(
  1032  		js.Pointer(&fn),
  1033  	)
  1034  	return
  1035  }
  1036  
  1037  // OffPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.removeListener" directly.
  1038  func OffPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret js.Void) {
  1039  	bindings.CallOffPrintRequested(
  1040  		js.Pointer(&ret),
  1041  		callback.Ref(),
  1042  	)
  1043  
  1044  	return
  1045  }
  1046  
  1047  // TryOffPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.removeListener"
  1048  // in a try/catch block and returns (_, err, ok = false) when it went through
  1049  // the catch clause.
  1050  func TryOffPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret js.Void, exception js.Any, ok bool) {
  1051  	ok = js.True == bindings.TryOffPrintRequested(
  1052  		js.Pointer(&ret), js.Pointer(&exception),
  1053  		callback.Ref(),
  1054  	)
  1055  
  1056  	return
  1057  }
  1058  
  1059  // HasFuncHasOnPrintRequested returns true if the function "WEBEXT.printerProvider.onPrintRequested.hasListener" exists.
  1060  func HasFuncHasOnPrintRequested() bool {
  1061  	return js.True == bindings.HasFuncHasOnPrintRequested()
  1062  }
  1063  
  1064  // FuncHasOnPrintRequested returns the function "WEBEXT.printerProvider.onPrintRequested.hasListener".
  1065  func FuncHasOnPrintRequested() (fn js.Func[func(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) bool]) {
  1066  	bindings.FuncHasOnPrintRequested(
  1067  		js.Pointer(&fn),
  1068  	)
  1069  	return
  1070  }
  1071  
  1072  // HasOnPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.hasListener" directly.
  1073  func HasOnPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret bool) {
  1074  	bindings.CallHasOnPrintRequested(
  1075  		js.Pointer(&ret),
  1076  		callback.Ref(),
  1077  	)
  1078  
  1079  	return
  1080  }
  1081  
  1082  // TryHasOnPrintRequested calls the function "WEBEXT.printerProvider.onPrintRequested.hasListener"
  1083  // in a try/catch block and returns (_, err, ok = false) when it went through
  1084  // the catch clause.
  1085  func TryHasOnPrintRequested(callback js.Func[func(printJob *PrintJob, resultCallback js.Func[func(result PrintError)])]) (ret bool, exception js.Any, ok bool) {
  1086  	ok = js.True == bindings.TryHasOnPrintRequested(
  1087  		js.Pointer(&ret), js.Pointer(&exception),
  1088  		callback.Ref(),
  1089  	)
  1090  
  1091  	return
  1092  }