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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package downloads
     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/downloads/bindings"
    11  )
    12  
    13  type BooleanDelta struct {
    14  	// Previous is "BooleanDelta.previous"
    15  	//
    16  	// Optional
    17  	//
    18  	// NOTE: FFI_USE_Previous MUST be set to true to make this field effective.
    19  	Previous bool
    20  	// Current is "BooleanDelta.current"
    21  	//
    22  	// Optional
    23  	//
    24  	// NOTE: FFI_USE_Current MUST be set to true to make this field effective.
    25  	Current bool
    26  
    27  	FFI_USE_Previous bool // for Previous.
    28  	FFI_USE_Current  bool // for Current.
    29  
    30  	FFI_USE bool
    31  }
    32  
    33  // FromRef calls UpdateFrom and returns a BooleanDelta with all fields set.
    34  func (p BooleanDelta) FromRef(ref js.Ref) BooleanDelta {
    35  	p.UpdateFrom(ref)
    36  	return p
    37  }
    38  
    39  // New creates a new BooleanDelta in the application heap.
    40  func (p BooleanDelta) New() js.Ref {
    41  	return bindings.BooleanDeltaJSLoad(
    42  		js.Pointer(&p), js.True, 0,
    43  	)
    44  }
    45  
    46  // UpdateFrom copies value of all fields of the heap object to p.
    47  func (p *BooleanDelta) UpdateFrom(ref js.Ref) {
    48  	bindings.BooleanDeltaJSStore(
    49  		js.Pointer(p), ref,
    50  	)
    51  }
    52  
    53  // Update writes all fields of the p to the heap object referenced by ref.
    54  func (p *BooleanDelta) Update(ref js.Ref) {
    55  	bindings.BooleanDeltaJSLoad(
    56  		js.Pointer(p), js.False, ref,
    57  	)
    58  }
    59  
    60  // FreeMembers frees fields with heap reference, if recursive is true
    61  // free all heap references reachable from p.
    62  func (p *BooleanDelta) FreeMembers(recursive bool) {
    63  }
    64  
    65  type DangerType uint32
    66  
    67  const (
    68  	_ DangerType = iota
    69  
    70  	DangerType_FILE
    71  	DangerType_URL
    72  	DangerType_CONTENT
    73  	DangerType_UNCOMMON
    74  	DangerType_HOST
    75  	DangerType_UNWANTED
    76  	DangerType_SAFE
    77  	DangerType_ACCEPTED
    78  	DangerType_ALLOWLISTED_BY_POLICY
    79  	DangerType_ASYNC_SCANNING
    80  	DangerType_PASSWORD_PROTECTED
    81  	DangerType_BLOCKED_TOO_LARGE
    82  	DangerType_SENSITIVE_CONTENT_WARNING
    83  	DangerType_SENSITIVE_CONTENT_BLOCK
    84  	DangerType_UNSUPPORTED_FILE_TYPE
    85  	DangerType_DEEP_SCANNED_FAILED
    86  	DangerType_DEEP_SCANNED_SAFE
    87  	DangerType_DEEP_SCANNED_OPENED_DANGEROUS
    88  	DangerType_PROMPT_FOR_SCANING
    89  	DangerType_ACCOUNT_COMPROMISE
    90  )
    91  
    92  func (DangerType) FromRef(str js.Ref) DangerType {
    93  	return DangerType(bindings.ConstOfDangerType(str))
    94  }
    95  
    96  func (x DangerType) String() (string, bool) {
    97  	switch x {
    98  	case DangerType_FILE:
    99  		return "file", true
   100  	case DangerType_URL:
   101  		return "url", true
   102  	case DangerType_CONTENT:
   103  		return "content", true
   104  	case DangerType_UNCOMMON:
   105  		return "uncommon", true
   106  	case DangerType_HOST:
   107  		return "host", true
   108  	case DangerType_UNWANTED:
   109  		return "unwanted", true
   110  	case DangerType_SAFE:
   111  		return "safe", true
   112  	case DangerType_ACCEPTED:
   113  		return "accepted", true
   114  	case DangerType_ALLOWLISTED_BY_POLICY:
   115  		return "allowlistedByPolicy", true
   116  	case DangerType_ASYNC_SCANNING:
   117  		return "asyncScanning", true
   118  	case DangerType_PASSWORD_PROTECTED:
   119  		return "passwordProtected", true
   120  	case DangerType_BLOCKED_TOO_LARGE:
   121  		return "blockedTooLarge", true
   122  	case DangerType_SENSITIVE_CONTENT_WARNING:
   123  		return "sensitiveContentWarning", true
   124  	case DangerType_SENSITIVE_CONTENT_BLOCK:
   125  		return "sensitiveContentBlock", true
   126  	case DangerType_UNSUPPORTED_FILE_TYPE:
   127  		return "unsupportedFileType", true
   128  	case DangerType_DEEP_SCANNED_FAILED:
   129  		return "deepScannedFailed", true
   130  	case DangerType_DEEP_SCANNED_SAFE:
   131  		return "deepScannedSafe", true
   132  	case DangerType_DEEP_SCANNED_OPENED_DANGEROUS:
   133  		return "deepScannedOpenedDangerous", true
   134  	case DangerType_PROMPT_FOR_SCANING:
   135  		return "promptForScaning", true
   136  	case DangerType_ACCOUNT_COMPROMISE:
   137  		return "accountCompromise", true
   138  	default:
   139  		return "", false
   140  	}
   141  }
   142  
   143  type DoubleDelta struct {
   144  	// Previous is "DoubleDelta.previous"
   145  	//
   146  	// Optional
   147  	//
   148  	// NOTE: FFI_USE_Previous MUST be set to true to make this field effective.
   149  	Previous float64
   150  	// Current is "DoubleDelta.current"
   151  	//
   152  	// Optional
   153  	//
   154  	// NOTE: FFI_USE_Current MUST be set to true to make this field effective.
   155  	Current float64
   156  
   157  	FFI_USE_Previous bool // for Previous.
   158  	FFI_USE_Current  bool // for Current.
   159  
   160  	FFI_USE bool
   161  }
   162  
   163  // FromRef calls UpdateFrom and returns a DoubleDelta with all fields set.
   164  func (p DoubleDelta) FromRef(ref js.Ref) DoubleDelta {
   165  	p.UpdateFrom(ref)
   166  	return p
   167  }
   168  
   169  // New creates a new DoubleDelta in the application heap.
   170  func (p DoubleDelta) New() js.Ref {
   171  	return bindings.DoubleDeltaJSLoad(
   172  		js.Pointer(&p), js.True, 0,
   173  	)
   174  }
   175  
   176  // UpdateFrom copies value of all fields of the heap object to p.
   177  func (p *DoubleDelta) UpdateFrom(ref js.Ref) {
   178  	bindings.DoubleDeltaJSStore(
   179  		js.Pointer(p), ref,
   180  	)
   181  }
   182  
   183  // Update writes all fields of the p to the heap object referenced by ref.
   184  func (p *DoubleDelta) Update(ref js.Ref) {
   185  	bindings.DoubleDeltaJSLoad(
   186  		js.Pointer(p), js.False, ref,
   187  	)
   188  }
   189  
   190  // FreeMembers frees fields with heap reference, if recursive is true
   191  // free all heap references reachable from p.
   192  func (p *DoubleDelta) FreeMembers(recursive bool) {
   193  }
   194  
   195  type DownloadCallbackFunc func(this js.Ref, downloadId int32) js.Ref
   196  
   197  func (fn DownloadCallbackFunc) Register() js.Func[func(downloadId int32)] {
   198  	return js.RegisterCallback[func(downloadId int32)](
   199  		fn, abi.FuncPCABIInternal(fn),
   200  	)
   201  }
   202  
   203  func (fn DownloadCallbackFunc) DispatchCallback(
   204  	targetPC uintptr, ctx *js.CallbackContext,
   205  ) {
   206  	args := ctx.Args()
   207  	if len(args) != 1+1 /* js this */ ||
   208  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   209  		js.ThrowInvalidCallbackInvocation()
   210  	}
   211  
   212  	if ctx.Return(fn(
   213  		args[0],
   214  
   215  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   216  	)) {
   217  		return
   218  	}
   219  
   220  	js.ThrowCallbackValueNotReturned()
   221  }
   222  
   223  type DownloadCallback[T any] struct {
   224  	Fn  func(arg T, this js.Ref, downloadId int32) js.Ref
   225  	Arg T
   226  }
   227  
   228  func (cb *DownloadCallback[T]) Register() js.Func[func(downloadId int32)] {
   229  	return js.RegisterCallback[func(downloadId int32)](
   230  		cb, abi.FuncPCABIInternal(cb.Fn),
   231  	)
   232  }
   233  
   234  func (cb *DownloadCallback[T]) DispatchCallback(
   235  	targetPC uintptr, ctx *js.CallbackContext,
   236  ) {
   237  	args := ctx.Args()
   238  	if len(args) != 1+1 /* js this */ ||
   239  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   240  		js.ThrowInvalidCallbackInvocation()
   241  	}
   242  
   243  	if ctx.Return(cb.Fn(
   244  		cb.Arg,
   245  		args[0],
   246  
   247  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
   248  	)) {
   249  		return
   250  	}
   251  
   252  	js.ThrowCallbackValueNotReturned()
   253  }
   254  
   255  type StringDelta struct {
   256  	// Previous is "StringDelta.previous"
   257  	//
   258  	// Optional
   259  	Previous js.String
   260  	// Current is "StringDelta.current"
   261  	//
   262  	// Optional
   263  	Current js.String
   264  
   265  	FFI_USE bool
   266  }
   267  
   268  // FromRef calls UpdateFrom and returns a StringDelta with all fields set.
   269  func (p StringDelta) FromRef(ref js.Ref) StringDelta {
   270  	p.UpdateFrom(ref)
   271  	return p
   272  }
   273  
   274  // New creates a new StringDelta in the application heap.
   275  func (p StringDelta) New() js.Ref {
   276  	return bindings.StringDeltaJSLoad(
   277  		js.Pointer(&p), js.True, 0,
   278  	)
   279  }
   280  
   281  // UpdateFrom copies value of all fields of the heap object to p.
   282  func (p *StringDelta) UpdateFrom(ref js.Ref) {
   283  	bindings.StringDeltaJSStore(
   284  		js.Pointer(p), ref,
   285  	)
   286  }
   287  
   288  // Update writes all fields of the p to the heap object referenced by ref.
   289  func (p *StringDelta) Update(ref js.Ref) {
   290  	bindings.StringDeltaJSLoad(
   291  		js.Pointer(p), js.False, ref,
   292  	)
   293  }
   294  
   295  // FreeMembers frees fields with heap reference, if recursive is true
   296  // free all heap references reachable from p.
   297  func (p *StringDelta) FreeMembers(recursive bool) {
   298  	js.Free(
   299  		p.Previous.Ref(),
   300  		p.Current.Ref(),
   301  	)
   302  	p.Previous = p.Previous.FromRef(js.Undefined)
   303  	p.Current = p.Current.FromRef(js.Undefined)
   304  }
   305  
   306  type DownloadDelta struct {
   307  	// Id is "DownloadDelta.id"
   308  	//
   309  	// Optional
   310  	//
   311  	// NOTE: FFI_USE_Id MUST be set to true to make this field effective.
   312  	Id int32
   313  	// Url is "DownloadDelta.url"
   314  	//
   315  	// Optional
   316  	//
   317  	// NOTE: Url.FFI_USE MUST be set to true to get Url used.
   318  	Url StringDelta
   319  	// FinalUrl is "DownloadDelta.finalUrl"
   320  	//
   321  	// Optional
   322  	//
   323  	// NOTE: FinalUrl.FFI_USE MUST be set to true to get FinalUrl used.
   324  	FinalUrl StringDelta
   325  	// Filename is "DownloadDelta.filename"
   326  	//
   327  	// Optional
   328  	//
   329  	// NOTE: Filename.FFI_USE MUST be set to true to get Filename used.
   330  	Filename StringDelta
   331  	// Danger is "DownloadDelta.danger"
   332  	//
   333  	// Optional
   334  	//
   335  	// NOTE: Danger.FFI_USE MUST be set to true to get Danger used.
   336  	Danger StringDelta
   337  	// Mime is "DownloadDelta.mime"
   338  	//
   339  	// Optional
   340  	//
   341  	// NOTE: Mime.FFI_USE MUST be set to true to get Mime used.
   342  	Mime StringDelta
   343  	// StartTime is "DownloadDelta.startTime"
   344  	//
   345  	// Optional
   346  	//
   347  	// NOTE: StartTime.FFI_USE MUST be set to true to get StartTime used.
   348  	StartTime StringDelta
   349  	// EndTime is "DownloadDelta.endTime"
   350  	//
   351  	// Optional
   352  	//
   353  	// NOTE: EndTime.FFI_USE MUST be set to true to get EndTime used.
   354  	EndTime StringDelta
   355  	// State is "DownloadDelta.state"
   356  	//
   357  	// Optional
   358  	//
   359  	// NOTE: State.FFI_USE MUST be set to true to get State used.
   360  	State StringDelta
   361  	// CanResume is "DownloadDelta.canResume"
   362  	//
   363  	// Optional
   364  	//
   365  	// NOTE: CanResume.FFI_USE MUST be set to true to get CanResume used.
   366  	CanResume BooleanDelta
   367  	// Paused is "DownloadDelta.paused"
   368  	//
   369  	// Optional
   370  	//
   371  	// NOTE: Paused.FFI_USE MUST be set to true to get Paused used.
   372  	Paused BooleanDelta
   373  	// Error is "DownloadDelta.error"
   374  	//
   375  	// Optional
   376  	//
   377  	// NOTE: Error.FFI_USE MUST be set to true to get Error used.
   378  	Error StringDelta
   379  	// TotalBytes is "DownloadDelta.totalBytes"
   380  	//
   381  	// Optional
   382  	//
   383  	// NOTE: TotalBytes.FFI_USE MUST be set to true to get TotalBytes used.
   384  	TotalBytes DoubleDelta
   385  	// FileSize is "DownloadDelta.fileSize"
   386  	//
   387  	// Optional
   388  	//
   389  	// NOTE: FileSize.FFI_USE MUST be set to true to get FileSize used.
   390  	FileSize DoubleDelta
   391  	// Exists is "DownloadDelta.exists"
   392  	//
   393  	// Optional
   394  	//
   395  	// NOTE: Exists.FFI_USE MUST be set to true to get Exists used.
   396  	Exists BooleanDelta
   397  
   398  	FFI_USE_Id bool // for Id.
   399  
   400  	FFI_USE bool
   401  }
   402  
   403  // FromRef calls UpdateFrom and returns a DownloadDelta with all fields set.
   404  func (p DownloadDelta) FromRef(ref js.Ref) DownloadDelta {
   405  	p.UpdateFrom(ref)
   406  	return p
   407  }
   408  
   409  // New creates a new DownloadDelta in the application heap.
   410  func (p DownloadDelta) New() js.Ref {
   411  	return bindings.DownloadDeltaJSLoad(
   412  		js.Pointer(&p), js.True, 0,
   413  	)
   414  }
   415  
   416  // UpdateFrom copies value of all fields of the heap object to p.
   417  func (p *DownloadDelta) UpdateFrom(ref js.Ref) {
   418  	bindings.DownloadDeltaJSStore(
   419  		js.Pointer(p), ref,
   420  	)
   421  }
   422  
   423  // Update writes all fields of the p to the heap object referenced by ref.
   424  func (p *DownloadDelta) Update(ref js.Ref) {
   425  	bindings.DownloadDeltaJSLoad(
   426  		js.Pointer(p), js.False, ref,
   427  	)
   428  }
   429  
   430  // FreeMembers frees fields with heap reference, if recursive is true
   431  // free all heap references reachable from p.
   432  func (p *DownloadDelta) FreeMembers(recursive bool) {
   433  	if recursive {
   434  		p.Url.FreeMembers(true)
   435  		p.FinalUrl.FreeMembers(true)
   436  		p.Filename.FreeMembers(true)
   437  		p.Danger.FreeMembers(true)
   438  		p.Mime.FreeMembers(true)
   439  		p.StartTime.FreeMembers(true)
   440  		p.EndTime.FreeMembers(true)
   441  		p.State.FreeMembers(true)
   442  		p.CanResume.FreeMembers(true)
   443  		p.Paused.FreeMembers(true)
   444  		p.Error.FreeMembers(true)
   445  		p.TotalBytes.FreeMembers(true)
   446  		p.FileSize.FreeMembers(true)
   447  		p.Exists.FreeMembers(true)
   448  	}
   449  }
   450  
   451  type State uint32
   452  
   453  const (
   454  	_ State = iota
   455  
   456  	State_IN_PROGRESS
   457  	State_INTERRUPTED
   458  	State_COMPLETE
   459  )
   460  
   461  func (State) FromRef(str js.Ref) State {
   462  	return State(bindings.ConstOfState(str))
   463  }
   464  
   465  func (x State) String() (string, bool) {
   466  	switch x {
   467  	case State_IN_PROGRESS:
   468  		return "in_progress", true
   469  	case State_INTERRUPTED:
   470  		return "interrupted", true
   471  	case State_COMPLETE:
   472  		return "complete", true
   473  	default:
   474  		return "", false
   475  	}
   476  }
   477  
   478  type InterruptReason uint32
   479  
   480  const (
   481  	_ InterruptReason = iota
   482  
   483  	InterruptReason_FILE_FAILED
   484  	InterruptReason_FILE_ACCESS_DENIED
   485  	InterruptReason_FILE_NO_SPACE
   486  	InterruptReason_FILE_NAME_TOO_LONG
   487  	InterruptReason_FILE_TOO_LARGE
   488  	InterruptReason_FILE_VIRUS_INFECTED
   489  	InterruptReason_FILE_TRANSIENT_ERROR
   490  	InterruptReason_FILE_BLOCKED
   491  	InterruptReason_FILE_SECURITY_CHECK_FAILED
   492  	InterruptReason_FILE_TOO_SHORT
   493  	InterruptReason_FILE_HASH_MISMATCH
   494  	InterruptReason_FILE_SAME_AS_SOURCE
   495  	InterruptReason_NETWORK_FAILED
   496  	InterruptReason_NETWORK_TIMEOUT
   497  	InterruptReason_NETWORK_DISCONNECTED
   498  	InterruptReason_NETWORK_SERVER_DOWN
   499  	InterruptReason_NETWORK_INVALID_REQUEST
   500  	InterruptReason_SERVER_FAILED
   501  	InterruptReason_SERVER_NO_RANGE
   502  	InterruptReason_SERVER_BAD_CONTENT
   503  	InterruptReason_SERVER_UNAUTHORIZED
   504  	InterruptReason_SERVER_CERT_PROBLEM
   505  	InterruptReason_SERVER_FORBIDDEN
   506  	InterruptReason_SERVER_UNREACHABLE
   507  	InterruptReason_SERVER_CONTENT_LENGTH_MISMATCH
   508  	InterruptReason_SERVER_CROSS_ORIGIN_REDIRECT
   509  	InterruptReason_USER_CANCELED
   510  	InterruptReason_USER_SHUTDOWN
   511  	InterruptReason_CRASH
   512  )
   513  
   514  func (InterruptReason) FromRef(str js.Ref) InterruptReason {
   515  	return InterruptReason(bindings.ConstOfInterruptReason(str))
   516  }
   517  
   518  func (x InterruptReason) String() (string, bool) {
   519  	switch x {
   520  	case InterruptReason_FILE_FAILED:
   521  		return "FILE_FAILED", true
   522  	case InterruptReason_FILE_ACCESS_DENIED:
   523  		return "FILE_ACCESS_DENIED", true
   524  	case InterruptReason_FILE_NO_SPACE:
   525  		return "FILE_NO_SPACE", true
   526  	case InterruptReason_FILE_NAME_TOO_LONG:
   527  		return "FILE_NAME_TOO_LONG", true
   528  	case InterruptReason_FILE_TOO_LARGE:
   529  		return "FILE_TOO_LARGE", true
   530  	case InterruptReason_FILE_VIRUS_INFECTED:
   531  		return "FILE_VIRUS_INFECTED", true
   532  	case InterruptReason_FILE_TRANSIENT_ERROR:
   533  		return "FILE_TRANSIENT_ERROR", true
   534  	case InterruptReason_FILE_BLOCKED:
   535  		return "FILE_BLOCKED", true
   536  	case InterruptReason_FILE_SECURITY_CHECK_FAILED:
   537  		return "FILE_SECURITY_CHECK_FAILED", true
   538  	case InterruptReason_FILE_TOO_SHORT:
   539  		return "FILE_TOO_SHORT", true
   540  	case InterruptReason_FILE_HASH_MISMATCH:
   541  		return "FILE_HASH_MISMATCH", true
   542  	case InterruptReason_FILE_SAME_AS_SOURCE:
   543  		return "FILE_SAME_AS_SOURCE", true
   544  	case InterruptReason_NETWORK_FAILED:
   545  		return "NETWORK_FAILED", true
   546  	case InterruptReason_NETWORK_TIMEOUT:
   547  		return "NETWORK_TIMEOUT", true
   548  	case InterruptReason_NETWORK_DISCONNECTED:
   549  		return "NETWORK_DISCONNECTED", true
   550  	case InterruptReason_NETWORK_SERVER_DOWN:
   551  		return "NETWORK_SERVER_DOWN", true
   552  	case InterruptReason_NETWORK_INVALID_REQUEST:
   553  		return "NETWORK_INVALID_REQUEST", true
   554  	case InterruptReason_SERVER_FAILED:
   555  		return "SERVER_FAILED", true
   556  	case InterruptReason_SERVER_NO_RANGE:
   557  		return "SERVER_NO_RANGE", true
   558  	case InterruptReason_SERVER_BAD_CONTENT:
   559  		return "SERVER_BAD_CONTENT", true
   560  	case InterruptReason_SERVER_UNAUTHORIZED:
   561  		return "SERVER_UNAUTHORIZED", true
   562  	case InterruptReason_SERVER_CERT_PROBLEM:
   563  		return "SERVER_CERT_PROBLEM", true
   564  	case InterruptReason_SERVER_FORBIDDEN:
   565  		return "SERVER_FORBIDDEN", true
   566  	case InterruptReason_SERVER_UNREACHABLE:
   567  		return "SERVER_UNREACHABLE", true
   568  	case InterruptReason_SERVER_CONTENT_LENGTH_MISMATCH:
   569  		return "SERVER_CONTENT_LENGTH_MISMATCH", true
   570  	case InterruptReason_SERVER_CROSS_ORIGIN_REDIRECT:
   571  		return "SERVER_CROSS_ORIGIN_REDIRECT", true
   572  	case InterruptReason_USER_CANCELED:
   573  		return "USER_CANCELED", true
   574  	case InterruptReason_USER_SHUTDOWN:
   575  		return "USER_SHUTDOWN", true
   576  	case InterruptReason_CRASH:
   577  		return "CRASH", true
   578  	default:
   579  		return "", false
   580  	}
   581  }
   582  
   583  type DownloadItem struct {
   584  	// Id is "DownloadItem.id"
   585  	//
   586  	// Optional
   587  	//
   588  	// NOTE: FFI_USE_Id MUST be set to true to make this field effective.
   589  	Id int32
   590  	// Url is "DownloadItem.url"
   591  	//
   592  	// Optional
   593  	Url js.String
   594  	// FinalUrl is "DownloadItem.finalUrl"
   595  	//
   596  	// Optional
   597  	FinalUrl js.String
   598  	// Referrer is "DownloadItem.referrer"
   599  	//
   600  	// Optional
   601  	Referrer js.String
   602  	// Filename is "DownloadItem.filename"
   603  	//
   604  	// Optional
   605  	Filename js.String
   606  	// Incognito is "DownloadItem.incognito"
   607  	//
   608  	// Optional
   609  	//
   610  	// NOTE: FFI_USE_Incognito MUST be set to true to make this field effective.
   611  	Incognito bool
   612  	// Danger is "DownloadItem.danger"
   613  	//
   614  	// Optional
   615  	Danger DangerType
   616  	// Mime is "DownloadItem.mime"
   617  	//
   618  	// Optional
   619  	Mime js.String
   620  	// StartTime is "DownloadItem.startTime"
   621  	//
   622  	// Optional
   623  	StartTime js.String
   624  	// EndTime is "DownloadItem.endTime"
   625  	//
   626  	// Optional
   627  	EndTime js.String
   628  	// EstimatedEndTime is "DownloadItem.estimatedEndTime"
   629  	//
   630  	// Optional
   631  	EstimatedEndTime js.String
   632  	// State is "DownloadItem.state"
   633  	//
   634  	// Optional
   635  	State State
   636  	// Paused is "DownloadItem.paused"
   637  	//
   638  	// Optional
   639  	//
   640  	// NOTE: FFI_USE_Paused MUST be set to true to make this field effective.
   641  	Paused bool
   642  	// CanResume is "DownloadItem.canResume"
   643  	//
   644  	// Optional
   645  	//
   646  	// NOTE: FFI_USE_CanResume MUST be set to true to make this field effective.
   647  	CanResume bool
   648  	// Error is "DownloadItem.error"
   649  	//
   650  	// Optional
   651  	Error InterruptReason
   652  	// BytesReceived is "DownloadItem.bytesReceived"
   653  	//
   654  	// Optional
   655  	//
   656  	// NOTE: FFI_USE_BytesReceived MUST be set to true to make this field effective.
   657  	BytesReceived float64
   658  	// TotalBytes is "DownloadItem.totalBytes"
   659  	//
   660  	// Optional
   661  	//
   662  	// NOTE: FFI_USE_TotalBytes MUST be set to true to make this field effective.
   663  	TotalBytes float64
   664  	// FileSize is "DownloadItem.fileSize"
   665  	//
   666  	// Optional
   667  	//
   668  	// NOTE: FFI_USE_FileSize MUST be set to true to make this field effective.
   669  	FileSize float64
   670  	// Exists is "DownloadItem.exists"
   671  	//
   672  	// Optional
   673  	//
   674  	// NOTE: FFI_USE_Exists MUST be set to true to make this field effective.
   675  	Exists bool
   676  	// ByExtensionId is "DownloadItem.byExtensionId"
   677  	//
   678  	// Optional
   679  	ByExtensionId js.String
   680  	// ByExtensionName is "DownloadItem.byExtensionName"
   681  	//
   682  	// Optional
   683  	ByExtensionName js.String
   684  
   685  	FFI_USE_Id            bool // for Id.
   686  	FFI_USE_Incognito     bool // for Incognito.
   687  	FFI_USE_Paused        bool // for Paused.
   688  	FFI_USE_CanResume     bool // for CanResume.
   689  	FFI_USE_BytesReceived bool // for BytesReceived.
   690  	FFI_USE_TotalBytes    bool // for TotalBytes.
   691  	FFI_USE_FileSize      bool // for FileSize.
   692  	FFI_USE_Exists        bool // for Exists.
   693  
   694  	FFI_USE bool
   695  }
   696  
   697  // FromRef calls UpdateFrom and returns a DownloadItem with all fields set.
   698  func (p DownloadItem) FromRef(ref js.Ref) DownloadItem {
   699  	p.UpdateFrom(ref)
   700  	return p
   701  }
   702  
   703  // New creates a new DownloadItem in the application heap.
   704  func (p DownloadItem) New() js.Ref {
   705  	return bindings.DownloadItemJSLoad(
   706  		js.Pointer(&p), js.True, 0,
   707  	)
   708  }
   709  
   710  // UpdateFrom copies value of all fields of the heap object to p.
   711  func (p *DownloadItem) UpdateFrom(ref js.Ref) {
   712  	bindings.DownloadItemJSStore(
   713  		js.Pointer(p), ref,
   714  	)
   715  }
   716  
   717  // Update writes all fields of the p to the heap object referenced by ref.
   718  func (p *DownloadItem) Update(ref js.Ref) {
   719  	bindings.DownloadItemJSLoad(
   720  		js.Pointer(p), js.False, ref,
   721  	)
   722  }
   723  
   724  // FreeMembers frees fields with heap reference, if recursive is true
   725  // free all heap references reachable from p.
   726  func (p *DownloadItem) FreeMembers(recursive bool) {
   727  	js.Free(
   728  		p.Url.Ref(),
   729  		p.FinalUrl.Ref(),
   730  		p.Referrer.Ref(),
   731  		p.Filename.Ref(),
   732  		p.Mime.Ref(),
   733  		p.StartTime.Ref(),
   734  		p.EndTime.Ref(),
   735  		p.EstimatedEndTime.Ref(),
   736  		p.ByExtensionId.Ref(),
   737  		p.ByExtensionName.Ref(),
   738  	)
   739  	p.Url = p.Url.FromRef(js.Undefined)
   740  	p.FinalUrl = p.FinalUrl.FromRef(js.Undefined)
   741  	p.Referrer = p.Referrer.FromRef(js.Undefined)
   742  	p.Filename = p.Filename.FromRef(js.Undefined)
   743  	p.Mime = p.Mime.FromRef(js.Undefined)
   744  	p.StartTime = p.StartTime.FromRef(js.Undefined)
   745  	p.EndTime = p.EndTime.FromRef(js.Undefined)
   746  	p.EstimatedEndTime = p.EstimatedEndTime.FromRef(js.Undefined)
   747  	p.ByExtensionId = p.ByExtensionId.FromRef(js.Undefined)
   748  	p.ByExtensionName = p.ByExtensionName.FromRef(js.Undefined)
   749  }
   750  
   751  type FilenameConflictAction uint32
   752  
   753  const (
   754  	_ FilenameConflictAction = iota
   755  
   756  	FilenameConflictAction_UNIQUIFY
   757  	FilenameConflictAction_OVERWRITE
   758  	FilenameConflictAction_PROMPT
   759  )
   760  
   761  func (FilenameConflictAction) FromRef(str js.Ref) FilenameConflictAction {
   762  	return FilenameConflictAction(bindings.ConstOfFilenameConflictAction(str))
   763  }
   764  
   765  func (x FilenameConflictAction) String() (string, bool) {
   766  	switch x {
   767  	case FilenameConflictAction_UNIQUIFY:
   768  		return "uniquify", true
   769  	case FilenameConflictAction_OVERWRITE:
   770  		return "overwrite", true
   771  	case FilenameConflictAction_PROMPT:
   772  		return "prompt", true
   773  	default:
   774  		return "", false
   775  	}
   776  }
   777  
   778  type HttpMethod uint32
   779  
   780  const (
   781  	_ HttpMethod = iota
   782  
   783  	HttpMethod_GET
   784  	HttpMethod_POST
   785  )
   786  
   787  func (HttpMethod) FromRef(str js.Ref) HttpMethod {
   788  	return HttpMethod(bindings.ConstOfHttpMethod(str))
   789  }
   790  
   791  func (x HttpMethod) String() (string, bool) {
   792  	switch x {
   793  	case HttpMethod_GET:
   794  		return "GET", true
   795  	case HttpMethod_POST:
   796  		return "POST", true
   797  	default:
   798  		return "", false
   799  	}
   800  }
   801  
   802  type HeaderNameValuePair struct {
   803  	// Name is "HeaderNameValuePair.name"
   804  	//
   805  	// Optional
   806  	Name js.String
   807  	// Value is "HeaderNameValuePair.value"
   808  	//
   809  	// Optional
   810  	Value js.String
   811  
   812  	FFI_USE bool
   813  }
   814  
   815  // FromRef calls UpdateFrom and returns a HeaderNameValuePair with all fields set.
   816  func (p HeaderNameValuePair) FromRef(ref js.Ref) HeaderNameValuePair {
   817  	p.UpdateFrom(ref)
   818  	return p
   819  }
   820  
   821  // New creates a new HeaderNameValuePair in the application heap.
   822  func (p HeaderNameValuePair) New() js.Ref {
   823  	return bindings.HeaderNameValuePairJSLoad(
   824  		js.Pointer(&p), js.True, 0,
   825  	)
   826  }
   827  
   828  // UpdateFrom copies value of all fields of the heap object to p.
   829  func (p *HeaderNameValuePair) UpdateFrom(ref js.Ref) {
   830  	bindings.HeaderNameValuePairJSStore(
   831  		js.Pointer(p), ref,
   832  	)
   833  }
   834  
   835  // Update writes all fields of the p to the heap object referenced by ref.
   836  func (p *HeaderNameValuePair) Update(ref js.Ref) {
   837  	bindings.HeaderNameValuePairJSLoad(
   838  		js.Pointer(p), js.False, ref,
   839  	)
   840  }
   841  
   842  // FreeMembers frees fields with heap reference, if recursive is true
   843  // free all heap references reachable from p.
   844  func (p *HeaderNameValuePair) FreeMembers(recursive bool) {
   845  	js.Free(
   846  		p.Name.Ref(),
   847  		p.Value.Ref(),
   848  	)
   849  	p.Name = p.Name.FromRef(js.Undefined)
   850  	p.Value = p.Value.FromRef(js.Undefined)
   851  }
   852  
   853  type DownloadOptions struct {
   854  	// Url is "DownloadOptions.url"
   855  	//
   856  	// Optional
   857  	Url js.String
   858  	// Filename is "DownloadOptions.filename"
   859  	//
   860  	// Optional
   861  	Filename js.String
   862  	// ConflictAction is "DownloadOptions.conflictAction"
   863  	//
   864  	// Optional
   865  	ConflictAction FilenameConflictAction
   866  	// SaveAs is "DownloadOptions.saveAs"
   867  	//
   868  	// Optional
   869  	//
   870  	// NOTE: FFI_USE_SaveAs MUST be set to true to make this field effective.
   871  	SaveAs bool
   872  	// Method is "DownloadOptions.method"
   873  	//
   874  	// Optional
   875  	Method HttpMethod
   876  	// Headers is "DownloadOptions.headers"
   877  	//
   878  	// Optional
   879  	Headers js.Array[HeaderNameValuePair]
   880  	// Body is "DownloadOptions.body"
   881  	//
   882  	// Optional
   883  	Body js.String
   884  
   885  	FFI_USE_SaveAs bool // for SaveAs.
   886  
   887  	FFI_USE bool
   888  }
   889  
   890  // FromRef calls UpdateFrom and returns a DownloadOptions with all fields set.
   891  func (p DownloadOptions) FromRef(ref js.Ref) DownloadOptions {
   892  	p.UpdateFrom(ref)
   893  	return p
   894  }
   895  
   896  // New creates a new DownloadOptions in the application heap.
   897  func (p DownloadOptions) New() js.Ref {
   898  	return bindings.DownloadOptionsJSLoad(
   899  		js.Pointer(&p), js.True, 0,
   900  	)
   901  }
   902  
   903  // UpdateFrom copies value of all fields of the heap object to p.
   904  func (p *DownloadOptions) UpdateFrom(ref js.Ref) {
   905  	bindings.DownloadOptionsJSStore(
   906  		js.Pointer(p), ref,
   907  	)
   908  }
   909  
   910  // Update writes all fields of the p to the heap object referenced by ref.
   911  func (p *DownloadOptions) Update(ref js.Ref) {
   912  	bindings.DownloadOptionsJSLoad(
   913  		js.Pointer(p), js.False, ref,
   914  	)
   915  }
   916  
   917  // FreeMembers frees fields with heap reference, if recursive is true
   918  // free all heap references reachable from p.
   919  func (p *DownloadOptions) FreeMembers(recursive bool) {
   920  	js.Free(
   921  		p.Url.Ref(),
   922  		p.Filename.Ref(),
   923  		p.Headers.Ref(),
   924  		p.Body.Ref(),
   925  	)
   926  	p.Url = p.Url.FromRef(js.Undefined)
   927  	p.Filename = p.Filename.FromRef(js.Undefined)
   928  	p.Headers = p.Headers.FromRef(js.Undefined)
   929  	p.Body = p.Body.FromRef(js.Undefined)
   930  }
   931  
   932  type DownloadQuery struct {
   933  	// Query is "DownloadQuery.query"
   934  	//
   935  	// Optional
   936  	Query js.Array[js.String]
   937  	// StartedBefore is "DownloadQuery.startedBefore"
   938  	//
   939  	// Optional
   940  	StartedBefore js.String
   941  	// StartedAfter is "DownloadQuery.startedAfter"
   942  	//
   943  	// Optional
   944  	StartedAfter js.String
   945  	// EndedBefore is "DownloadQuery.endedBefore"
   946  	//
   947  	// Optional
   948  	EndedBefore js.String
   949  	// EndedAfter is "DownloadQuery.endedAfter"
   950  	//
   951  	// Optional
   952  	EndedAfter js.String
   953  	// TotalBytesGreater is "DownloadQuery.totalBytesGreater"
   954  	//
   955  	// Optional
   956  	//
   957  	// NOTE: FFI_USE_TotalBytesGreater MUST be set to true to make this field effective.
   958  	TotalBytesGreater float64
   959  	// TotalBytesLess is "DownloadQuery.totalBytesLess"
   960  	//
   961  	// Optional
   962  	//
   963  	// NOTE: FFI_USE_TotalBytesLess MUST be set to true to make this field effective.
   964  	TotalBytesLess float64
   965  	// FilenameRegex is "DownloadQuery.filenameRegex"
   966  	//
   967  	// Optional
   968  	FilenameRegex js.String
   969  	// UrlRegex is "DownloadQuery.urlRegex"
   970  	//
   971  	// Optional
   972  	UrlRegex js.String
   973  	// FinalUrlRegex is "DownloadQuery.finalUrlRegex"
   974  	//
   975  	// Optional
   976  	FinalUrlRegex js.String
   977  	// Limit is "DownloadQuery.limit"
   978  	//
   979  	// Optional
   980  	//
   981  	// NOTE: FFI_USE_Limit MUST be set to true to make this field effective.
   982  	Limit int32
   983  	// OrderBy is "DownloadQuery.orderBy"
   984  	//
   985  	// Optional
   986  	OrderBy js.Array[js.String]
   987  	// Id is "DownloadQuery.id"
   988  	//
   989  	// Optional
   990  	//
   991  	// NOTE: FFI_USE_Id MUST be set to true to make this field effective.
   992  	Id int32
   993  	// Url is "DownloadQuery.url"
   994  	//
   995  	// Optional
   996  	Url js.String
   997  	// FinalUrl is "DownloadQuery.finalUrl"
   998  	//
   999  	// Optional
  1000  	FinalUrl js.String
  1001  	// Filename is "DownloadQuery.filename"
  1002  	//
  1003  	// Optional
  1004  	Filename js.String
  1005  	// Danger is "DownloadQuery.danger"
  1006  	//
  1007  	// Optional
  1008  	Danger DangerType
  1009  	// Mime is "DownloadQuery.mime"
  1010  	//
  1011  	// Optional
  1012  	Mime js.String
  1013  	// StartTime is "DownloadQuery.startTime"
  1014  	//
  1015  	// Optional
  1016  	StartTime js.String
  1017  	// EndTime is "DownloadQuery.endTime"
  1018  	//
  1019  	// Optional
  1020  	EndTime js.String
  1021  	// State is "DownloadQuery.state"
  1022  	//
  1023  	// Optional
  1024  	State State
  1025  	// Paused is "DownloadQuery.paused"
  1026  	//
  1027  	// Optional
  1028  	//
  1029  	// NOTE: FFI_USE_Paused MUST be set to true to make this field effective.
  1030  	Paused bool
  1031  	// Error is "DownloadQuery.error"
  1032  	//
  1033  	// Optional
  1034  	Error InterruptReason
  1035  	// BytesReceived is "DownloadQuery.bytesReceived"
  1036  	//
  1037  	// Optional
  1038  	//
  1039  	// NOTE: FFI_USE_BytesReceived MUST be set to true to make this field effective.
  1040  	BytesReceived float64
  1041  	// TotalBytes is "DownloadQuery.totalBytes"
  1042  	//
  1043  	// Optional
  1044  	//
  1045  	// NOTE: FFI_USE_TotalBytes MUST be set to true to make this field effective.
  1046  	TotalBytes float64
  1047  	// FileSize is "DownloadQuery.fileSize"
  1048  	//
  1049  	// Optional
  1050  	//
  1051  	// NOTE: FFI_USE_FileSize MUST be set to true to make this field effective.
  1052  	FileSize float64
  1053  	// Exists is "DownloadQuery.exists"
  1054  	//
  1055  	// Optional
  1056  	//
  1057  	// NOTE: FFI_USE_Exists MUST be set to true to make this field effective.
  1058  	Exists bool
  1059  
  1060  	FFI_USE_TotalBytesGreater bool // for TotalBytesGreater.
  1061  	FFI_USE_TotalBytesLess    bool // for TotalBytesLess.
  1062  	FFI_USE_Limit             bool // for Limit.
  1063  	FFI_USE_Id                bool // for Id.
  1064  	FFI_USE_Paused            bool // for Paused.
  1065  	FFI_USE_BytesReceived     bool // for BytesReceived.
  1066  	FFI_USE_TotalBytes        bool // for TotalBytes.
  1067  	FFI_USE_FileSize          bool // for FileSize.
  1068  	FFI_USE_Exists            bool // for Exists.
  1069  
  1070  	FFI_USE bool
  1071  }
  1072  
  1073  // FromRef calls UpdateFrom and returns a DownloadQuery with all fields set.
  1074  func (p DownloadQuery) FromRef(ref js.Ref) DownloadQuery {
  1075  	p.UpdateFrom(ref)
  1076  	return p
  1077  }
  1078  
  1079  // New creates a new DownloadQuery in the application heap.
  1080  func (p DownloadQuery) New() js.Ref {
  1081  	return bindings.DownloadQueryJSLoad(
  1082  		js.Pointer(&p), js.True, 0,
  1083  	)
  1084  }
  1085  
  1086  // UpdateFrom copies value of all fields of the heap object to p.
  1087  func (p *DownloadQuery) UpdateFrom(ref js.Ref) {
  1088  	bindings.DownloadQueryJSStore(
  1089  		js.Pointer(p), ref,
  1090  	)
  1091  }
  1092  
  1093  // Update writes all fields of the p to the heap object referenced by ref.
  1094  func (p *DownloadQuery) Update(ref js.Ref) {
  1095  	bindings.DownloadQueryJSLoad(
  1096  		js.Pointer(p), js.False, ref,
  1097  	)
  1098  }
  1099  
  1100  // FreeMembers frees fields with heap reference, if recursive is true
  1101  // free all heap references reachable from p.
  1102  func (p *DownloadQuery) FreeMembers(recursive bool) {
  1103  	js.Free(
  1104  		p.Query.Ref(),
  1105  		p.StartedBefore.Ref(),
  1106  		p.StartedAfter.Ref(),
  1107  		p.EndedBefore.Ref(),
  1108  		p.EndedAfter.Ref(),
  1109  		p.FilenameRegex.Ref(),
  1110  		p.UrlRegex.Ref(),
  1111  		p.FinalUrlRegex.Ref(),
  1112  		p.OrderBy.Ref(),
  1113  		p.Url.Ref(),
  1114  		p.FinalUrl.Ref(),
  1115  		p.Filename.Ref(),
  1116  		p.Mime.Ref(),
  1117  		p.StartTime.Ref(),
  1118  		p.EndTime.Ref(),
  1119  	)
  1120  	p.Query = p.Query.FromRef(js.Undefined)
  1121  	p.StartedBefore = p.StartedBefore.FromRef(js.Undefined)
  1122  	p.StartedAfter = p.StartedAfter.FromRef(js.Undefined)
  1123  	p.EndedBefore = p.EndedBefore.FromRef(js.Undefined)
  1124  	p.EndedAfter = p.EndedAfter.FromRef(js.Undefined)
  1125  	p.FilenameRegex = p.FilenameRegex.FromRef(js.Undefined)
  1126  	p.UrlRegex = p.UrlRegex.FromRef(js.Undefined)
  1127  	p.FinalUrlRegex = p.FinalUrlRegex.FromRef(js.Undefined)
  1128  	p.OrderBy = p.OrderBy.FromRef(js.Undefined)
  1129  	p.Url = p.Url.FromRef(js.Undefined)
  1130  	p.FinalUrl = p.FinalUrl.FromRef(js.Undefined)
  1131  	p.Filename = p.Filename.FromRef(js.Undefined)
  1132  	p.Mime = p.Mime.FromRef(js.Undefined)
  1133  	p.StartTime = p.StartTime.FromRef(js.Undefined)
  1134  	p.EndTime = p.EndTime.FromRef(js.Undefined)
  1135  }
  1136  
  1137  type EraseCallbackFunc func(this js.Ref, erasedIds js.Array[int32]) js.Ref
  1138  
  1139  func (fn EraseCallbackFunc) Register() js.Func[func(erasedIds js.Array[int32])] {
  1140  	return js.RegisterCallback[func(erasedIds js.Array[int32])](
  1141  		fn, abi.FuncPCABIInternal(fn),
  1142  	)
  1143  }
  1144  
  1145  func (fn EraseCallbackFunc) DispatchCallback(
  1146  	targetPC uintptr, ctx *js.CallbackContext,
  1147  ) {
  1148  	args := ctx.Args()
  1149  	if len(args) != 1+1 /* js this */ ||
  1150  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1151  		js.ThrowInvalidCallbackInvocation()
  1152  	}
  1153  
  1154  	if ctx.Return(fn(
  1155  		args[0],
  1156  
  1157  		js.Array[int32]{}.FromRef(args[0+1]),
  1158  	)) {
  1159  		return
  1160  	}
  1161  
  1162  	js.ThrowCallbackValueNotReturned()
  1163  }
  1164  
  1165  type EraseCallback[T any] struct {
  1166  	Fn  func(arg T, this js.Ref, erasedIds js.Array[int32]) js.Ref
  1167  	Arg T
  1168  }
  1169  
  1170  func (cb *EraseCallback[T]) Register() js.Func[func(erasedIds js.Array[int32])] {
  1171  	return js.RegisterCallback[func(erasedIds js.Array[int32])](
  1172  		cb, abi.FuncPCABIInternal(cb.Fn),
  1173  	)
  1174  }
  1175  
  1176  func (cb *EraseCallback[T]) DispatchCallback(
  1177  	targetPC uintptr, ctx *js.CallbackContext,
  1178  ) {
  1179  	args := ctx.Args()
  1180  	if len(args) != 1+1 /* js this */ ||
  1181  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1182  		js.ThrowInvalidCallbackInvocation()
  1183  	}
  1184  
  1185  	if ctx.Return(cb.Fn(
  1186  		cb.Arg,
  1187  		args[0],
  1188  
  1189  		js.Array[int32]{}.FromRef(args[0+1]),
  1190  	)) {
  1191  		return
  1192  	}
  1193  
  1194  	js.ThrowCallbackValueNotReturned()
  1195  }
  1196  
  1197  type FilenameSuggestion struct {
  1198  	// Filename is "FilenameSuggestion.filename"
  1199  	//
  1200  	// Optional
  1201  	Filename js.String
  1202  	// ConflictAction is "FilenameSuggestion.conflictAction"
  1203  	//
  1204  	// Optional
  1205  	ConflictAction FilenameConflictAction
  1206  
  1207  	FFI_USE bool
  1208  }
  1209  
  1210  // FromRef calls UpdateFrom and returns a FilenameSuggestion with all fields set.
  1211  func (p FilenameSuggestion) FromRef(ref js.Ref) FilenameSuggestion {
  1212  	p.UpdateFrom(ref)
  1213  	return p
  1214  }
  1215  
  1216  // New creates a new FilenameSuggestion in the application heap.
  1217  func (p FilenameSuggestion) New() js.Ref {
  1218  	return bindings.FilenameSuggestionJSLoad(
  1219  		js.Pointer(&p), js.True, 0,
  1220  	)
  1221  }
  1222  
  1223  // UpdateFrom copies value of all fields of the heap object to p.
  1224  func (p *FilenameSuggestion) UpdateFrom(ref js.Ref) {
  1225  	bindings.FilenameSuggestionJSStore(
  1226  		js.Pointer(p), ref,
  1227  	)
  1228  }
  1229  
  1230  // Update writes all fields of the p to the heap object referenced by ref.
  1231  func (p *FilenameSuggestion) Update(ref js.Ref) {
  1232  	bindings.FilenameSuggestionJSLoad(
  1233  		js.Pointer(p), js.False, ref,
  1234  	)
  1235  }
  1236  
  1237  // FreeMembers frees fields with heap reference, if recursive is true
  1238  // free all heap references reachable from p.
  1239  func (p *FilenameSuggestion) FreeMembers(recursive bool) {
  1240  	js.Free(
  1241  		p.Filename.Ref(),
  1242  	)
  1243  	p.Filename = p.Filename.FromRef(js.Undefined)
  1244  }
  1245  
  1246  type GetFileIconCallbackFunc func(this js.Ref, iconURL js.String) js.Ref
  1247  
  1248  func (fn GetFileIconCallbackFunc) Register() js.Func[func(iconURL js.String)] {
  1249  	return js.RegisterCallback[func(iconURL js.String)](
  1250  		fn, abi.FuncPCABIInternal(fn),
  1251  	)
  1252  }
  1253  
  1254  func (fn GetFileIconCallbackFunc) DispatchCallback(
  1255  	targetPC uintptr, ctx *js.CallbackContext,
  1256  ) {
  1257  	args := ctx.Args()
  1258  	if len(args) != 1+1 /* js this */ ||
  1259  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1260  		js.ThrowInvalidCallbackInvocation()
  1261  	}
  1262  
  1263  	if ctx.Return(fn(
  1264  		args[0],
  1265  
  1266  		js.String{}.FromRef(args[0+1]),
  1267  	)) {
  1268  		return
  1269  	}
  1270  
  1271  	js.ThrowCallbackValueNotReturned()
  1272  }
  1273  
  1274  type GetFileIconCallback[T any] struct {
  1275  	Fn  func(arg T, this js.Ref, iconURL js.String) js.Ref
  1276  	Arg T
  1277  }
  1278  
  1279  func (cb *GetFileIconCallback[T]) Register() js.Func[func(iconURL js.String)] {
  1280  	return js.RegisterCallback[func(iconURL js.String)](
  1281  		cb, abi.FuncPCABIInternal(cb.Fn),
  1282  	)
  1283  }
  1284  
  1285  func (cb *GetFileIconCallback[T]) DispatchCallback(
  1286  	targetPC uintptr, ctx *js.CallbackContext,
  1287  ) {
  1288  	args := ctx.Args()
  1289  	if len(args) != 1+1 /* js this */ ||
  1290  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1291  		js.ThrowInvalidCallbackInvocation()
  1292  	}
  1293  
  1294  	if ctx.Return(cb.Fn(
  1295  		cb.Arg,
  1296  		args[0],
  1297  
  1298  		js.String{}.FromRef(args[0+1]),
  1299  	)) {
  1300  		return
  1301  	}
  1302  
  1303  	js.ThrowCallbackValueNotReturned()
  1304  }
  1305  
  1306  type GetFileIconOptions struct {
  1307  	// Size is "GetFileIconOptions.size"
  1308  	//
  1309  	// Optional
  1310  	//
  1311  	// NOTE: FFI_USE_Size MUST be set to true to make this field effective.
  1312  	Size int32
  1313  
  1314  	FFI_USE_Size bool // for Size.
  1315  
  1316  	FFI_USE bool
  1317  }
  1318  
  1319  // FromRef calls UpdateFrom and returns a GetFileIconOptions with all fields set.
  1320  func (p GetFileIconOptions) FromRef(ref js.Ref) GetFileIconOptions {
  1321  	p.UpdateFrom(ref)
  1322  	return p
  1323  }
  1324  
  1325  // New creates a new GetFileIconOptions in the application heap.
  1326  func (p GetFileIconOptions) New() js.Ref {
  1327  	return bindings.GetFileIconOptionsJSLoad(
  1328  		js.Pointer(&p), js.True, 0,
  1329  	)
  1330  }
  1331  
  1332  // UpdateFrom copies value of all fields of the heap object to p.
  1333  func (p *GetFileIconOptions) UpdateFrom(ref js.Ref) {
  1334  	bindings.GetFileIconOptionsJSStore(
  1335  		js.Pointer(p), ref,
  1336  	)
  1337  }
  1338  
  1339  // Update writes all fields of the p to the heap object referenced by ref.
  1340  func (p *GetFileIconOptions) Update(ref js.Ref) {
  1341  	bindings.GetFileIconOptionsJSLoad(
  1342  		js.Pointer(p), js.False, ref,
  1343  	)
  1344  }
  1345  
  1346  // FreeMembers frees fields with heap reference, if recursive is true
  1347  // free all heap references reachable from p.
  1348  func (p *GetFileIconOptions) FreeMembers(recursive bool) {
  1349  }
  1350  
  1351  type NullCallbackFunc func(this js.Ref) js.Ref
  1352  
  1353  func (fn NullCallbackFunc) Register() js.Func[func()] {
  1354  	return js.RegisterCallback[func()](
  1355  		fn, abi.FuncPCABIInternal(fn),
  1356  	)
  1357  }
  1358  
  1359  func (fn NullCallbackFunc) DispatchCallback(
  1360  	targetPC uintptr, ctx *js.CallbackContext,
  1361  ) {
  1362  	args := ctx.Args()
  1363  	if len(args) != 0+1 /* js this */ ||
  1364  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1365  		js.ThrowInvalidCallbackInvocation()
  1366  	}
  1367  
  1368  	if ctx.Return(fn(
  1369  		args[0],
  1370  	)) {
  1371  		return
  1372  	}
  1373  
  1374  	js.ThrowCallbackValueNotReturned()
  1375  }
  1376  
  1377  type NullCallback[T any] struct {
  1378  	Fn  func(arg T, this js.Ref) js.Ref
  1379  	Arg T
  1380  }
  1381  
  1382  func (cb *NullCallback[T]) Register() js.Func[func()] {
  1383  	return js.RegisterCallback[func()](
  1384  		cb, abi.FuncPCABIInternal(cb.Fn),
  1385  	)
  1386  }
  1387  
  1388  func (cb *NullCallback[T]) DispatchCallback(
  1389  	targetPC uintptr, ctx *js.CallbackContext,
  1390  ) {
  1391  	args := ctx.Args()
  1392  	if len(args) != 0+1 /* js this */ ||
  1393  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1394  		js.ThrowInvalidCallbackInvocation()
  1395  	}
  1396  
  1397  	if ctx.Return(cb.Fn(
  1398  		cb.Arg,
  1399  		args[0],
  1400  	)) {
  1401  		return
  1402  	}
  1403  
  1404  	js.ThrowCallbackValueNotReturned()
  1405  }
  1406  
  1407  type SearchCallbackFunc func(this js.Ref, results js.Array[DownloadItem]) js.Ref
  1408  
  1409  func (fn SearchCallbackFunc) Register() js.Func[func(results js.Array[DownloadItem])] {
  1410  	return js.RegisterCallback[func(results js.Array[DownloadItem])](
  1411  		fn, abi.FuncPCABIInternal(fn),
  1412  	)
  1413  }
  1414  
  1415  func (fn SearchCallbackFunc) DispatchCallback(
  1416  	targetPC uintptr, ctx *js.CallbackContext,
  1417  ) {
  1418  	args := ctx.Args()
  1419  	if len(args) != 1+1 /* js this */ ||
  1420  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1421  		js.ThrowInvalidCallbackInvocation()
  1422  	}
  1423  
  1424  	if ctx.Return(fn(
  1425  		args[0],
  1426  
  1427  		js.Array[DownloadItem]{}.FromRef(args[0+1]),
  1428  	)) {
  1429  		return
  1430  	}
  1431  
  1432  	js.ThrowCallbackValueNotReturned()
  1433  }
  1434  
  1435  type SearchCallback[T any] struct {
  1436  	Fn  func(arg T, this js.Ref, results js.Array[DownloadItem]) js.Ref
  1437  	Arg T
  1438  }
  1439  
  1440  func (cb *SearchCallback[T]) Register() js.Func[func(results js.Array[DownloadItem])] {
  1441  	return js.RegisterCallback[func(results js.Array[DownloadItem])](
  1442  		cb, abi.FuncPCABIInternal(cb.Fn),
  1443  	)
  1444  }
  1445  
  1446  func (cb *SearchCallback[T]) DispatchCallback(
  1447  	targetPC uintptr, ctx *js.CallbackContext,
  1448  ) {
  1449  	args := ctx.Args()
  1450  	if len(args) != 1+1 /* js this */ ||
  1451  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1452  		js.ThrowInvalidCallbackInvocation()
  1453  	}
  1454  
  1455  	if ctx.Return(cb.Fn(
  1456  		cb.Arg,
  1457  		args[0],
  1458  
  1459  		js.Array[DownloadItem]{}.FromRef(args[0+1]),
  1460  	)) {
  1461  		return
  1462  	}
  1463  
  1464  	js.ThrowCallbackValueNotReturned()
  1465  }
  1466  
  1467  type SuggestFilenameCallbackFunc func(this js.Ref, suggestion *FilenameSuggestion) js.Ref
  1468  
  1469  func (fn SuggestFilenameCallbackFunc) Register() js.Func[func(suggestion *FilenameSuggestion)] {
  1470  	return js.RegisterCallback[func(suggestion *FilenameSuggestion)](
  1471  		fn, abi.FuncPCABIInternal(fn),
  1472  	)
  1473  }
  1474  
  1475  func (fn SuggestFilenameCallbackFunc) DispatchCallback(
  1476  	targetPC uintptr, ctx *js.CallbackContext,
  1477  ) {
  1478  	args := ctx.Args()
  1479  	if len(args) != 1+1 /* js this */ ||
  1480  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1481  		js.ThrowInvalidCallbackInvocation()
  1482  	}
  1483  	var arg0 FilenameSuggestion
  1484  	arg0.UpdateFrom(args[0+1])
  1485  	defer arg0.FreeMembers(true)
  1486  
  1487  	if ctx.Return(fn(
  1488  		args[0],
  1489  
  1490  		mark.NoEscape(&arg0),
  1491  	)) {
  1492  		return
  1493  	}
  1494  
  1495  	js.ThrowCallbackValueNotReturned()
  1496  }
  1497  
  1498  type SuggestFilenameCallback[T any] struct {
  1499  	Fn  func(arg T, this js.Ref, suggestion *FilenameSuggestion) js.Ref
  1500  	Arg T
  1501  }
  1502  
  1503  func (cb *SuggestFilenameCallback[T]) Register() js.Func[func(suggestion *FilenameSuggestion)] {
  1504  	return js.RegisterCallback[func(suggestion *FilenameSuggestion)](
  1505  		cb, abi.FuncPCABIInternal(cb.Fn),
  1506  	)
  1507  }
  1508  
  1509  func (cb *SuggestFilenameCallback[T]) DispatchCallback(
  1510  	targetPC uintptr, ctx *js.CallbackContext,
  1511  ) {
  1512  	args := ctx.Args()
  1513  	if len(args) != 1+1 /* js this */ ||
  1514  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1515  		js.ThrowInvalidCallbackInvocation()
  1516  	}
  1517  	var arg0 FilenameSuggestion
  1518  	arg0.UpdateFrom(args[0+1])
  1519  	defer arg0.FreeMembers(true)
  1520  
  1521  	if ctx.Return(cb.Fn(
  1522  		cb.Arg,
  1523  		args[0],
  1524  
  1525  		mark.NoEscape(&arg0),
  1526  	)) {
  1527  		return
  1528  	}
  1529  
  1530  	js.ThrowCallbackValueNotReturned()
  1531  }
  1532  
  1533  type UiOptions struct {
  1534  	// Enabled is "UiOptions.enabled"
  1535  	//
  1536  	// Optional
  1537  	//
  1538  	// NOTE: FFI_USE_Enabled MUST be set to true to make this field effective.
  1539  	Enabled bool
  1540  
  1541  	FFI_USE_Enabled bool // for Enabled.
  1542  
  1543  	FFI_USE bool
  1544  }
  1545  
  1546  // FromRef calls UpdateFrom and returns a UiOptions with all fields set.
  1547  func (p UiOptions) FromRef(ref js.Ref) UiOptions {
  1548  	p.UpdateFrom(ref)
  1549  	return p
  1550  }
  1551  
  1552  // New creates a new UiOptions in the application heap.
  1553  func (p UiOptions) New() js.Ref {
  1554  	return bindings.UiOptionsJSLoad(
  1555  		js.Pointer(&p), js.True, 0,
  1556  	)
  1557  }
  1558  
  1559  // UpdateFrom copies value of all fields of the heap object to p.
  1560  func (p *UiOptions) UpdateFrom(ref js.Ref) {
  1561  	bindings.UiOptionsJSStore(
  1562  		js.Pointer(p), ref,
  1563  	)
  1564  }
  1565  
  1566  // Update writes all fields of the p to the heap object referenced by ref.
  1567  func (p *UiOptions) Update(ref js.Ref) {
  1568  	bindings.UiOptionsJSLoad(
  1569  		js.Pointer(p), js.False, ref,
  1570  	)
  1571  }
  1572  
  1573  // FreeMembers frees fields with heap reference, if recursive is true
  1574  // free all heap references reachable from p.
  1575  func (p *UiOptions) FreeMembers(recursive bool) {
  1576  }
  1577  
  1578  // HasFuncAcceptDanger returns true if the function "WEBEXT.downloads.acceptDanger" exists.
  1579  func HasFuncAcceptDanger() bool {
  1580  	return js.True == bindings.HasFuncAcceptDanger()
  1581  }
  1582  
  1583  // FuncAcceptDanger returns the function "WEBEXT.downloads.acceptDanger".
  1584  func FuncAcceptDanger() (fn js.Func[func(downloadId int32) js.Promise[js.Void]]) {
  1585  	bindings.FuncAcceptDanger(
  1586  		js.Pointer(&fn),
  1587  	)
  1588  	return
  1589  }
  1590  
  1591  // AcceptDanger calls the function "WEBEXT.downloads.acceptDanger" directly.
  1592  func AcceptDanger(downloadId int32) (ret js.Promise[js.Void]) {
  1593  	bindings.CallAcceptDanger(
  1594  		js.Pointer(&ret),
  1595  		int32(downloadId),
  1596  	)
  1597  
  1598  	return
  1599  }
  1600  
  1601  // TryAcceptDanger calls the function "WEBEXT.downloads.acceptDanger"
  1602  // in a try/catch block and returns (_, err, ok = false) when it went through
  1603  // the catch clause.
  1604  func TryAcceptDanger(downloadId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1605  	ok = js.True == bindings.TryAcceptDanger(
  1606  		js.Pointer(&ret), js.Pointer(&exception),
  1607  		int32(downloadId),
  1608  	)
  1609  
  1610  	return
  1611  }
  1612  
  1613  // HasFuncCancel returns true if the function "WEBEXT.downloads.cancel" exists.
  1614  func HasFuncCancel() bool {
  1615  	return js.True == bindings.HasFuncCancel()
  1616  }
  1617  
  1618  // FuncCancel returns the function "WEBEXT.downloads.cancel".
  1619  func FuncCancel() (fn js.Func[func(downloadId int32) js.Promise[js.Void]]) {
  1620  	bindings.FuncCancel(
  1621  		js.Pointer(&fn),
  1622  	)
  1623  	return
  1624  }
  1625  
  1626  // Cancel calls the function "WEBEXT.downloads.cancel" directly.
  1627  func Cancel(downloadId int32) (ret js.Promise[js.Void]) {
  1628  	bindings.CallCancel(
  1629  		js.Pointer(&ret),
  1630  		int32(downloadId),
  1631  	)
  1632  
  1633  	return
  1634  }
  1635  
  1636  // TryCancel calls the function "WEBEXT.downloads.cancel"
  1637  // in a try/catch block and returns (_, err, ok = false) when it went through
  1638  // the catch clause.
  1639  func TryCancel(downloadId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1640  	ok = js.True == bindings.TryCancel(
  1641  		js.Pointer(&ret), js.Pointer(&exception),
  1642  		int32(downloadId),
  1643  	)
  1644  
  1645  	return
  1646  }
  1647  
  1648  // HasFuncDownload returns true if the function "WEBEXT.downloads.download" exists.
  1649  func HasFuncDownload() bool {
  1650  	return js.True == bindings.HasFuncDownload()
  1651  }
  1652  
  1653  // FuncDownload returns the function "WEBEXT.downloads.download".
  1654  func FuncDownload() (fn js.Func[func(options DownloadOptions) js.Promise[js.Number[int32]]]) {
  1655  	bindings.FuncDownload(
  1656  		js.Pointer(&fn),
  1657  	)
  1658  	return
  1659  }
  1660  
  1661  // Download calls the function "WEBEXT.downloads.download" directly.
  1662  func Download(options DownloadOptions) (ret js.Promise[js.Number[int32]]) {
  1663  	bindings.CallDownload(
  1664  		js.Pointer(&ret),
  1665  		js.Pointer(&options),
  1666  	)
  1667  
  1668  	return
  1669  }
  1670  
  1671  // TryDownload calls the function "WEBEXT.downloads.download"
  1672  // in a try/catch block and returns (_, err, ok = false) when it went through
  1673  // the catch clause.
  1674  func TryDownload(options DownloadOptions) (ret js.Promise[js.Number[int32]], exception js.Any, ok bool) {
  1675  	ok = js.True == bindings.TryDownload(
  1676  		js.Pointer(&ret), js.Pointer(&exception),
  1677  		js.Pointer(&options),
  1678  	)
  1679  
  1680  	return
  1681  }
  1682  
  1683  // HasFuncErase returns true if the function "WEBEXT.downloads.erase" exists.
  1684  func HasFuncErase() bool {
  1685  	return js.True == bindings.HasFuncErase()
  1686  }
  1687  
  1688  // FuncErase returns the function "WEBEXT.downloads.erase".
  1689  func FuncErase() (fn js.Func[func(query DownloadQuery) js.Promise[js.Array[int32]]]) {
  1690  	bindings.FuncErase(
  1691  		js.Pointer(&fn),
  1692  	)
  1693  	return
  1694  }
  1695  
  1696  // Erase calls the function "WEBEXT.downloads.erase" directly.
  1697  func Erase(query DownloadQuery) (ret js.Promise[js.Array[int32]]) {
  1698  	bindings.CallErase(
  1699  		js.Pointer(&ret),
  1700  		js.Pointer(&query),
  1701  	)
  1702  
  1703  	return
  1704  }
  1705  
  1706  // TryErase calls the function "WEBEXT.downloads.erase"
  1707  // in a try/catch block and returns (_, err, ok = false) when it went through
  1708  // the catch clause.
  1709  func TryErase(query DownloadQuery) (ret js.Promise[js.Array[int32]], exception js.Any, ok bool) {
  1710  	ok = js.True == bindings.TryErase(
  1711  		js.Pointer(&ret), js.Pointer(&exception),
  1712  		js.Pointer(&query),
  1713  	)
  1714  
  1715  	return
  1716  }
  1717  
  1718  // HasFuncGetFileIcon returns true if the function "WEBEXT.downloads.getFileIcon" exists.
  1719  func HasFuncGetFileIcon() bool {
  1720  	return js.True == bindings.HasFuncGetFileIcon()
  1721  }
  1722  
  1723  // FuncGetFileIcon returns the function "WEBEXT.downloads.getFileIcon".
  1724  func FuncGetFileIcon() (fn js.Func[func(downloadId int32, options GetFileIconOptions) js.Promise[js.String]]) {
  1725  	bindings.FuncGetFileIcon(
  1726  		js.Pointer(&fn),
  1727  	)
  1728  	return
  1729  }
  1730  
  1731  // GetFileIcon calls the function "WEBEXT.downloads.getFileIcon" directly.
  1732  func GetFileIcon(downloadId int32, options GetFileIconOptions) (ret js.Promise[js.String]) {
  1733  	bindings.CallGetFileIcon(
  1734  		js.Pointer(&ret),
  1735  		int32(downloadId),
  1736  		js.Pointer(&options),
  1737  	)
  1738  
  1739  	return
  1740  }
  1741  
  1742  // TryGetFileIcon calls the function "WEBEXT.downloads.getFileIcon"
  1743  // in a try/catch block and returns (_, err, ok = false) when it went through
  1744  // the catch clause.
  1745  func TryGetFileIcon(downloadId int32, options GetFileIconOptions) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1746  	ok = js.True == bindings.TryGetFileIcon(
  1747  		js.Pointer(&ret), js.Pointer(&exception),
  1748  		int32(downloadId),
  1749  		js.Pointer(&options),
  1750  	)
  1751  
  1752  	return
  1753  }
  1754  
  1755  type OnChangedEventCallbackFunc func(this js.Ref, downloadDelta *DownloadDelta) js.Ref
  1756  
  1757  func (fn OnChangedEventCallbackFunc) Register() js.Func[func(downloadDelta *DownloadDelta)] {
  1758  	return js.RegisterCallback[func(downloadDelta *DownloadDelta)](
  1759  		fn, abi.FuncPCABIInternal(fn),
  1760  	)
  1761  }
  1762  
  1763  func (fn OnChangedEventCallbackFunc) DispatchCallback(
  1764  	targetPC uintptr, ctx *js.CallbackContext,
  1765  ) {
  1766  	args := ctx.Args()
  1767  	if len(args) != 1+1 /* js this */ ||
  1768  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1769  		js.ThrowInvalidCallbackInvocation()
  1770  	}
  1771  	var arg0 DownloadDelta
  1772  	arg0.UpdateFrom(args[0+1])
  1773  	defer arg0.FreeMembers(true)
  1774  
  1775  	if ctx.Return(fn(
  1776  		args[0],
  1777  
  1778  		mark.NoEscape(&arg0),
  1779  	)) {
  1780  		return
  1781  	}
  1782  
  1783  	js.ThrowCallbackValueNotReturned()
  1784  }
  1785  
  1786  type OnChangedEventCallback[T any] struct {
  1787  	Fn  func(arg T, this js.Ref, downloadDelta *DownloadDelta) js.Ref
  1788  	Arg T
  1789  }
  1790  
  1791  func (cb *OnChangedEventCallback[T]) Register() js.Func[func(downloadDelta *DownloadDelta)] {
  1792  	return js.RegisterCallback[func(downloadDelta *DownloadDelta)](
  1793  		cb, abi.FuncPCABIInternal(cb.Fn),
  1794  	)
  1795  }
  1796  
  1797  func (cb *OnChangedEventCallback[T]) DispatchCallback(
  1798  	targetPC uintptr, ctx *js.CallbackContext,
  1799  ) {
  1800  	args := ctx.Args()
  1801  	if len(args) != 1+1 /* js this */ ||
  1802  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1803  		js.ThrowInvalidCallbackInvocation()
  1804  	}
  1805  	var arg0 DownloadDelta
  1806  	arg0.UpdateFrom(args[0+1])
  1807  	defer arg0.FreeMembers(true)
  1808  
  1809  	if ctx.Return(cb.Fn(
  1810  		cb.Arg,
  1811  		args[0],
  1812  
  1813  		mark.NoEscape(&arg0),
  1814  	)) {
  1815  		return
  1816  	}
  1817  
  1818  	js.ThrowCallbackValueNotReturned()
  1819  }
  1820  
  1821  // HasFuncOnChanged returns true if the function "WEBEXT.downloads.onChanged.addListener" exists.
  1822  func HasFuncOnChanged() bool {
  1823  	return js.True == bindings.HasFuncOnChanged()
  1824  }
  1825  
  1826  // FuncOnChanged returns the function "WEBEXT.downloads.onChanged.addListener".
  1827  func FuncOnChanged() (fn js.Func[func(callback js.Func[func(downloadDelta *DownloadDelta)])]) {
  1828  	bindings.FuncOnChanged(
  1829  		js.Pointer(&fn),
  1830  	)
  1831  	return
  1832  }
  1833  
  1834  // OnChanged calls the function "WEBEXT.downloads.onChanged.addListener" directly.
  1835  func OnChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret js.Void) {
  1836  	bindings.CallOnChanged(
  1837  		js.Pointer(&ret),
  1838  		callback.Ref(),
  1839  	)
  1840  
  1841  	return
  1842  }
  1843  
  1844  // TryOnChanged calls the function "WEBEXT.downloads.onChanged.addListener"
  1845  // in a try/catch block and returns (_, err, ok = false) when it went through
  1846  // the catch clause.
  1847  func TryOnChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret js.Void, exception js.Any, ok bool) {
  1848  	ok = js.True == bindings.TryOnChanged(
  1849  		js.Pointer(&ret), js.Pointer(&exception),
  1850  		callback.Ref(),
  1851  	)
  1852  
  1853  	return
  1854  }
  1855  
  1856  // HasFuncOffChanged returns true if the function "WEBEXT.downloads.onChanged.removeListener" exists.
  1857  func HasFuncOffChanged() bool {
  1858  	return js.True == bindings.HasFuncOffChanged()
  1859  }
  1860  
  1861  // FuncOffChanged returns the function "WEBEXT.downloads.onChanged.removeListener".
  1862  func FuncOffChanged() (fn js.Func[func(callback js.Func[func(downloadDelta *DownloadDelta)])]) {
  1863  	bindings.FuncOffChanged(
  1864  		js.Pointer(&fn),
  1865  	)
  1866  	return
  1867  }
  1868  
  1869  // OffChanged calls the function "WEBEXT.downloads.onChanged.removeListener" directly.
  1870  func OffChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret js.Void) {
  1871  	bindings.CallOffChanged(
  1872  		js.Pointer(&ret),
  1873  		callback.Ref(),
  1874  	)
  1875  
  1876  	return
  1877  }
  1878  
  1879  // TryOffChanged calls the function "WEBEXT.downloads.onChanged.removeListener"
  1880  // in a try/catch block and returns (_, err, ok = false) when it went through
  1881  // the catch clause.
  1882  func TryOffChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret js.Void, exception js.Any, ok bool) {
  1883  	ok = js.True == bindings.TryOffChanged(
  1884  		js.Pointer(&ret), js.Pointer(&exception),
  1885  		callback.Ref(),
  1886  	)
  1887  
  1888  	return
  1889  }
  1890  
  1891  // HasFuncHasOnChanged returns true if the function "WEBEXT.downloads.onChanged.hasListener" exists.
  1892  func HasFuncHasOnChanged() bool {
  1893  	return js.True == bindings.HasFuncHasOnChanged()
  1894  }
  1895  
  1896  // FuncHasOnChanged returns the function "WEBEXT.downloads.onChanged.hasListener".
  1897  func FuncHasOnChanged() (fn js.Func[func(callback js.Func[func(downloadDelta *DownloadDelta)]) bool]) {
  1898  	bindings.FuncHasOnChanged(
  1899  		js.Pointer(&fn),
  1900  	)
  1901  	return
  1902  }
  1903  
  1904  // HasOnChanged calls the function "WEBEXT.downloads.onChanged.hasListener" directly.
  1905  func HasOnChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret bool) {
  1906  	bindings.CallHasOnChanged(
  1907  		js.Pointer(&ret),
  1908  		callback.Ref(),
  1909  	)
  1910  
  1911  	return
  1912  }
  1913  
  1914  // TryHasOnChanged calls the function "WEBEXT.downloads.onChanged.hasListener"
  1915  // in a try/catch block and returns (_, err, ok = false) when it went through
  1916  // the catch clause.
  1917  func TryHasOnChanged(callback js.Func[func(downloadDelta *DownloadDelta)]) (ret bool, exception js.Any, ok bool) {
  1918  	ok = js.True == bindings.TryHasOnChanged(
  1919  		js.Pointer(&ret), js.Pointer(&exception),
  1920  		callback.Ref(),
  1921  	)
  1922  
  1923  	return
  1924  }
  1925  
  1926  type OnCreatedEventCallbackFunc func(this js.Ref, downloadItem *DownloadItem) js.Ref
  1927  
  1928  func (fn OnCreatedEventCallbackFunc) Register() js.Func[func(downloadItem *DownloadItem)] {
  1929  	return js.RegisterCallback[func(downloadItem *DownloadItem)](
  1930  		fn, abi.FuncPCABIInternal(fn),
  1931  	)
  1932  }
  1933  
  1934  func (fn OnCreatedEventCallbackFunc) DispatchCallback(
  1935  	targetPC uintptr, ctx *js.CallbackContext,
  1936  ) {
  1937  	args := ctx.Args()
  1938  	if len(args) != 1+1 /* js this */ ||
  1939  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1940  		js.ThrowInvalidCallbackInvocation()
  1941  	}
  1942  	var arg0 DownloadItem
  1943  	arg0.UpdateFrom(args[0+1])
  1944  	defer arg0.FreeMembers(true)
  1945  
  1946  	if ctx.Return(fn(
  1947  		args[0],
  1948  
  1949  		mark.NoEscape(&arg0),
  1950  	)) {
  1951  		return
  1952  	}
  1953  
  1954  	js.ThrowCallbackValueNotReturned()
  1955  }
  1956  
  1957  type OnCreatedEventCallback[T any] struct {
  1958  	Fn  func(arg T, this js.Ref, downloadItem *DownloadItem) js.Ref
  1959  	Arg T
  1960  }
  1961  
  1962  func (cb *OnCreatedEventCallback[T]) Register() js.Func[func(downloadItem *DownloadItem)] {
  1963  	return js.RegisterCallback[func(downloadItem *DownloadItem)](
  1964  		cb, abi.FuncPCABIInternal(cb.Fn),
  1965  	)
  1966  }
  1967  
  1968  func (cb *OnCreatedEventCallback[T]) DispatchCallback(
  1969  	targetPC uintptr, ctx *js.CallbackContext,
  1970  ) {
  1971  	args := ctx.Args()
  1972  	if len(args) != 1+1 /* js this */ ||
  1973  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1974  		js.ThrowInvalidCallbackInvocation()
  1975  	}
  1976  	var arg0 DownloadItem
  1977  	arg0.UpdateFrom(args[0+1])
  1978  	defer arg0.FreeMembers(true)
  1979  
  1980  	if ctx.Return(cb.Fn(
  1981  		cb.Arg,
  1982  		args[0],
  1983  
  1984  		mark.NoEscape(&arg0),
  1985  	)) {
  1986  		return
  1987  	}
  1988  
  1989  	js.ThrowCallbackValueNotReturned()
  1990  }
  1991  
  1992  // HasFuncOnCreated returns true if the function "WEBEXT.downloads.onCreated.addListener" exists.
  1993  func HasFuncOnCreated() bool {
  1994  	return js.True == bindings.HasFuncOnCreated()
  1995  }
  1996  
  1997  // FuncOnCreated returns the function "WEBEXT.downloads.onCreated.addListener".
  1998  func FuncOnCreated() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem)])]) {
  1999  	bindings.FuncOnCreated(
  2000  		js.Pointer(&fn),
  2001  	)
  2002  	return
  2003  }
  2004  
  2005  // OnCreated calls the function "WEBEXT.downloads.onCreated.addListener" directly.
  2006  func OnCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret js.Void) {
  2007  	bindings.CallOnCreated(
  2008  		js.Pointer(&ret),
  2009  		callback.Ref(),
  2010  	)
  2011  
  2012  	return
  2013  }
  2014  
  2015  // TryOnCreated calls the function "WEBEXT.downloads.onCreated.addListener"
  2016  // in a try/catch block and returns (_, err, ok = false) when it went through
  2017  // the catch clause.
  2018  func TryOnCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret js.Void, exception js.Any, ok bool) {
  2019  	ok = js.True == bindings.TryOnCreated(
  2020  		js.Pointer(&ret), js.Pointer(&exception),
  2021  		callback.Ref(),
  2022  	)
  2023  
  2024  	return
  2025  }
  2026  
  2027  // HasFuncOffCreated returns true if the function "WEBEXT.downloads.onCreated.removeListener" exists.
  2028  func HasFuncOffCreated() bool {
  2029  	return js.True == bindings.HasFuncOffCreated()
  2030  }
  2031  
  2032  // FuncOffCreated returns the function "WEBEXT.downloads.onCreated.removeListener".
  2033  func FuncOffCreated() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem)])]) {
  2034  	bindings.FuncOffCreated(
  2035  		js.Pointer(&fn),
  2036  	)
  2037  	return
  2038  }
  2039  
  2040  // OffCreated calls the function "WEBEXT.downloads.onCreated.removeListener" directly.
  2041  func OffCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret js.Void) {
  2042  	bindings.CallOffCreated(
  2043  		js.Pointer(&ret),
  2044  		callback.Ref(),
  2045  	)
  2046  
  2047  	return
  2048  }
  2049  
  2050  // TryOffCreated calls the function "WEBEXT.downloads.onCreated.removeListener"
  2051  // in a try/catch block and returns (_, err, ok = false) when it went through
  2052  // the catch clause.
  2053  func TryOffCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret js.Void, exception js.Any, ok bool) {
  2054  	ok = js.True == bindings.TryOffCreated(
  2055  		js.Pointer(&ret), js.Pointer(&exception),
  2056  		callback.Ref(),
  2057  	)
  2058  
  2059  	return
  2060  }
  2061  
  2062  // HasFuncHasOnCreated returns true if the function "WEBEXT.downloads.onCreated.hasListener" exists.
  2063  func HasFuncHasOnCreated() bool {
  2064  	return js.True == bindings.HasFuncHasOnCreated()
  2065  }
  2066  
  2067  // FuncHasOnCreated returns the function "WEBEXT.downloads.onCreated.hasListener".
  2068  func FuncHasOnCreated() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem)]) bool]) {
  2069  	bindings.FuncHasOnCreated(
  2070  		js.Pointer(&fn),
  2071  	)
  2072  	return
  2073  }
  2074  
  2075  // HasOnCreated calls the function "WEBEXT.downloads.onCreated.hasListener" directly.
  2076  func HasOnCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret bool) {
  2077  	bindings.CallHasOnCreated(
  2078  		js.Pointer(&ret),
  2079  		callback.Ref(),
  2080  	)
  2081  
  2082  	return
  2083  }
  2084  
  2085  // TryHasOnCreated calls the function "WEBEXT.downloads.onCreated.hasListener"
  2086  // in a try/catch block and returns (_, err, ok = false) when it went through
  2087  // the catch clause.
  2088  func TryHasOnCreated(callback js.Func[func(downloadItem *DownloadItem)]) (ret bool, exception js.Any, ok bool) {
  2089  	ok = js.True == bindings.TryHasOnCreated(
  2090  		js.Pointer(&ret), js.Pointer(&exception),
  2091  		callback.Ref(),
  2092  	)
  2093  
  2094  	return
  2095  }
  2096  
  2097  type OnDeterminingFilenameEventCallbackFunc func(this js.Ref, downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)]) js.Ref
  2098  
  2099  func (fn OnDeterminingFilenameEventCallbackFunc) Register() js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])] {
  2100  	return js.RegisterCallback[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])](
  2101  		fn, abi.FuncPCABIInternal(fn),
  2102  	)
  2103  }
  2104  
  2105  func (fn OnDeterminingFilenameEventCallbackFunc) DispatchCallback(
  2106  	targetPC uintptr, ctx *js.CallbackContext,
  2107  ) {
  2108  	args := ctx.Args()
  2109  	if len(args) != 2+1 /* js this */ ||
  2110  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2111  		js.ThrowInvalidCallbackInvocation()
  2112  	}
  2113  	var arg0 DownloadItem
  2114  	arg0.UpdateFrom(args[0+1])
  2115  	defer arg0.FreeMembers(true)
  2116  
  2117  	if ctx.Return(fn(
  2118  		args[0],
  2119  
  2120  		mark.NoEscape(&arg0),
  2121  		js.Func[func(suggestion *FilenameSuggestion)]{}.FromRef(args[1+1]),
  2122  	)) {
  2123  		return
  2124  	}
  2125  
  2126  	js.ThrowCallbackValueNotReturned()
  2127  }
  2128  
  2129  type OnDeterminingFilenameEventCallback[T any] struct {
  2130  	Fn  func(arg T, this js.Ref, downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)]) js.Ref
  2131  	Arg T
  2132  }
  2133  
  2134  func (cb *OnDeterminingFilenameEventCallback[T]) Register() js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])] {
  2135  	return js.RegisterCallback[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])](
  2136  		cb, abi.FuncPCABIInternal(cb.Fn),
  2137  	)
  2138  }
  2139  
  2140  func (cb *OnDeterminingFilenameEventCallback[T]) DispatchCallback(
  2141  	targetPC uintptr, ctx *js.CallbackContext,
  2142  ) {
  2143  	args := ctx.Args()
  2144  	if len(args) != 2+1 /* js this */ ||
  2145  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2146  		js.ThrowInvalidCallbackInvocation()
  2147  	}
  2148  	var arg0 DownloadItem
  2149  	arg0.UpdateFrom(args[0+1])
  2150  	defer arg0.FreeMembers(true)
  2151  
  2152  	if ctx.Return(cb.Fn(
  2153  		cb.Arg,
  2154  		args[0],
  2155  
  2156  		mark.NoEscape(&arg0),
  2157  		js.Func[func(suggestion *FilenameSuggestion)]{}.FromRef(args[1+1]),
  2158  	)) {
  2159  		return
  2160  	}
  2161  
  2162  	js.ThrowCallbackValueNotReturned()
  2163  }
  2164  
  2165  // HasFuncOnDeterminingFilename returns true if the function "WEBEXT.downloads.onDeterminingFilename.addListener" exists.
  2166  func HasFuncOnDeterminingFilename() bool {
  2167  	return js.True == bindings.HasFuncOnDeterminingFilename()
  2168  }
  2169  
  2170  // FuncOnDeterminingFilename returns the function "WEBEXT.downloads.onDeterminingFilename.addListener".
  2171  func FuncOnDeterminingFilename() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])])]) {
  2172  	bindings.FuncOnDeterminingFilename(
  2173  		js.Pointer(&fn),
  2174  	)
  2175  	return
  2176  }
  2177  
  2178  // OnDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.addListener" directly.
  2179  func OnDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret js.Void) {
  2180  	bindings.CallOnDeterminingFilename(
  2181  		js.Pointer(&ret),
  2182  		callback.Ref(),
  2183  	)
  2184  
  2185  	return
  2186  }
  2187  
  2188  // TryOnDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.addListener"
  2189  // in a try/catch block and returns (_, err, ok = false) when it went through
  2190  // the catch clause.
  2191  func TryOnDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret js.Void, exception js.Any, ok bool) {
  2192  	ok = js.True == bindings.TryOnDeterminingFilename(
  2193  		js.Pointer(&ret), js.Pointer(&exception),
  2194  		callback.Ref(),
  2195  	)
  2196  
  2197  	return
  2198  }
  2199  
  2200  // HasFuncOffDeterminingFilename returns true if the function "WEBEXT.downloads.onDeterminingFilename.removeListener" exists.
  2201  func HasFuncOffDeterminingFilename() bool {
  2202  	return js.True == bindings.HasFuncOffDeterminingFilename()
  2203  }
  2204  
  2205  // FuncOffDeterminingFilename returns the function "WEBEXT.downloads.onDeterminingFilename.removeListener".
  2206  func FuncOffDeterminingFilename() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])])]) {
  2207  	bindings.FuncOffDeterminingFilename(
  2208  		js.Pointer(&fn),
  2209  	)
  2210  	return
  2211  }
  2212  
  2213  // OffDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.removeListener" directly.
  2214  func OffDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret js.Void) {
  2215  	bindings.CallOffDeterminingFilename(
  2216  		js.Pointer(&ret),
  2217  		callback.Ref(),
  2218  	)
  2219  
  2220  	return
  2221  }
  2222  
  2223  // TryOffDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.removeListener"
  2224  // in a try/catch block and returns (_, err, ok = false) when it went through
  2225  // the catch clause.
  2226  func TryOffDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret js.Void, exception js.Any, ok bool) {
  2227  	ok = js.True == bindings.TryOffDeterminingFilename(
  2228  		js.Pointer(&ret), js.Pointer(&exception),
  2229  		callback.Ref(),
  2230  	)
  2231  
  2232  	return
  2233  }
  2234  
  2235  // HasFuncHasOnDeterminingFilename returns true if the function "WEBEXT.downloads.onDeterminingFilename.hasListener" exists.
  2236  func HasFuncHasOnDeterminingFilename() bool {
  2237  	return js.True == bindings.HasFuncHasOnDeterminingFilename()
  2238  }
  2239  
  2240  // FuncHasOnDeterminingFilename returns the function "WEBEXT.downloads.onDeterminingFilename.hasListener".
  2241  func FuncHasOnDeterminingFilename() (fn js.Func[func(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) bool]) {
  2242  	bindings.FuncHasOnDeterminingFilename(
  2243  		js.Pointer(&fn),
  2244  	)
  2245  	return
  2246  }
  2247  
  2248  // HasOnDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.hasListener" directly.
  2249  func HasOnDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret bool) {
  2250  	bindings.CallHasOnDeterminingFilename(
  2251  		js.Pointer(&ret),
  2252  		callback.Ref(),
  2253  	)
  2254  
  2255  	return
  2256  }
  2257  
  2258  // TryHasOnDeterminingFilename calls the function "WEBEXT.downloads.onDeterminingFilename.hasListener"
  2259  // in a try/catch block and returns (_, err, ok = false) when it went through
  2260  // the catch clause.
  2261  func TryHasOnDeterminingFilename(callback js.Func[func(downloadItem *DownloadItem, suggest js.Func[func(suggestion *FilenameSuggestion)])]) (ret bool, exception js.Any, ok bool) {
  2262  	ok = js.True == bindings.TryHasOnDeterminingFilename(
  2263  		js.Pointer(&ret), js.Pointer(&exception),
  2264  		callback.Ref(),
  2265  	)
  2266  
  2267  	return
  2268  }
  2269  
  2270  type OnErasedEventCallbackFunc func(this js.Ref, downloadId int32) js.Ref
  2271  
  2272  func (fn OnErasedEventCallbackFunc) Register() js.Func[func(downloadId int32)] {
  2273  	return js.RegisterCallback[func(downloadId int32)](
  2274  		fn, abi.FuncPCABIInternal(fn),
  2275  	)
  2276  }
  2277  
  2278  func (fn OnErasedEventCallbackFunc) DispatchCallback(
  2279  	targetPC uintptr, ctx *js.CallbackContext,
  2280  ) {
  2281  	args := ctx.Args()
  2282  	if len(args) != 1+1 /* js this */ ||
  2283  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  2284  		js.ThrowInvalidCallbackInvocation()
  2285  	}
  2286  
  2287  	if ctx.Return(fn(
  2288  		args[0],
  2289  
  2290  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  2291  	)) {
  2292  		return
  2293  	}
  2294  
  2295  	js.ThrowCallbackValueNotReturned()
  2296  }
  2297  
  2298  type OnErasedEventCallback[T any] struct {
  2299  	Fn  func(arg T, this js.Ref, downloadId int32) js.Ref
  2300  	Arg T
  2301  }
  2302  
  2303  func (cb *OnErasedEventCallback[T]) Register() js.Func[func(downloadId int32)] {
  2304  	return js.RegisterCallback[func(downloadId int32)](
  2305  		cb, abi.FuncPCABIInternal(cb.Fn),
  2306  	)
  2307  }
  2308  
  2309  func (cb *OnErasedEventCallback[T]) DispatchCallback(
  2310  	targetPC uintptr, ctx *js.CallbackContext,
  2311  ) {
  2312  	args := ctx.Args()
  2313  	if len(args) != 1+1 /* js this */ ||
  2314  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  2315  		js.ThrowInvalidCallbackInvocation()
  2316  	}
  2317  
  2318  	if ctx.Return(cb.Fn(
  2319  		cb.Arg,
  2320  		args[0],
  2321  
  2322  		js.Number[int32]{}.FromRef(args[0+1]).Get(),
  2323  	)) {
  2324  		return
  2325  	}
  2326  
  2327  	js.ThrowCallbackValueNotReturned()
  2328  }
  2329  
  2330  // HasFuncOnErased returns true if the function "WEBEXT.downloads.onErased.addListener" exists.
  2331  func HasFuncOnErased() bool {
  2332  	return js.True == bindings.HasFuncOnErased()
  2333  }
  2334  
  2335  // FuncOnErased returns the function "WEBEXT.downloads.onErased.addListener".
  2336  func FuncOnErased() (fn js.Func[func(callback js.Func[func(downloadId int32)])]) {
  2337  	bindings.FuncOnErased(
  2338  		js.Pointer(&fn),
  2339  	)
  2340  	return
  2341  }
  2342  
  2343  // OnErased calls the function "WEBEXT.downloads.onErased.addListener" directly.
  2344  func OnErased(callback js.Func[func(downloadId int32)]) (ret js.Void) {
  2345  	bindings.CallOnErased(
  2346  		js.Pointer(&ret),
  2347  		callback.Ref(),
  2348  	)
  2349  
  2350  	return
  2351  }
  2352  
  2353  // TryOnErased calls the function "WEBEXT.downloads.onErased.addListener"
  2354  // in a try/catch block and returns (_, err, ok = false) when it went through
  2355  // the catch clause.
  2356  func TryOnErased(callback js.Func[func(downloadId int32)]) (ret js.Void, exception js.Any, ok bool) {
  2357  	ok = js.True == bindings.TryOnErased(
  2358  		js.Pointer(&ret), js.Pointer(&exception),
  2359  		callback.Ref(),
  2360  	)
  2361  
  2362  	return
  2363  }
  2364  
  2365  // HasFuncOffErased returns true if the function "WEBEXT.downloads.onErased.removeListener" exists.
  2366  func HasFuncOffErased() bool {
  2367  	return js.True == bindings.HasFuncOffErased()
  2368  }
  2369  
  2370  // FuncOffErased returns the function "WEBEXT.downloads.onErased.removeListener".
  2371  func FuncOffErased() (fn js.Func[func(callback js.Func[func(downloadId int32)])]) {
  2372  	bindings.FuncOffErased(
  2373  		js.Pointer(&fn),
  2374  	)
  2375  	return
  2376  }
  2377  
  2378  // OffErased calls the function "WEBEXT.downloads.onErased.removeListener" directly.
  2379  func OffErased(callback js.Func[func(downloadId int32)]) (ret js.Void) {
  2380  	bindings.CallOffErased(
  2381  		js.Pointer(&ret),
  2382  		callback.Ref(),
  2383  	)
  2384  
  2385  	return
  2386  }
  2387  
  2388  // TryOffErased calls the function "WEBEXT.downloads.onErased.removeListener"
  2389  // in a try/catch block and returns (_, err, ok = false) when it went through
  2390  // the catch clause.
  2391  func TryOffErased(callback js.Func[func(downloadId int32)]) (ret js.Void, exception js.Any, ok bool) {
  2392  	ok = js.True == bindings.TryOffErased(
  2393  		js.Pointer(&ret), js.Pointer(&exception),
  2394  		callback.Ref(),
  2395  	)
  2396  
  2397  	return
  2398  }
  2399  
  2400  // HasFuncHasOnErased returns true if the function "WEBEXT.downloads.onErased.hasListener" exists.
  2401  func HasFuncHasOnErased() bool {
  2402  	return js.True == bindings.HasFuncHasOnErased()
  2403  }
  2404  
  2405  // FuncHasOnErased returns the function "WEBEXT.downloads.onErased.hasListener".
  2406  func FuncHasOnErased() (fn js.Func[func(callback js.Func[func(downloadId int32)]) bool]) {
  2407  	bindings.FuncHasOnErased(
  2408  		js.Pointer(&fn),
  2409  	)
  2410  	return
  2411  }
  2412  
  2413  // HasOnErased calls the function "WEBEXT.downloads.onErased.hasListener" directly.
  2414  func HasOnErased(callback js.Func[func(downloadId int32)]) (ret bool) {
  2415  	bindings.CallHasOnErased(
  2416  		js.Pointer(&ret),
  2417  		callback.Ref(),
  2418  	)
  2419  
  2420  	return
  2421  }
  2422  
  2423  // TryHasOnErased calls the function "WEBEXT.downloads.onErased.hasListener"
  2424  // in a try/catch block and returns (_, err, ok = false) when it went through
  2425  // the catch clause.
  2426  func TryHasOnErased(callback js.Func[func(downloadId int32)]) (ret bool, exception js.Any, ok bool) {
  2427  	ok = js.True == bindings.TryHasOnErased(
  2428  		js.Pointer(&ret), js.Pointer(&exception),
  2429  		callback.Ref(),
  2430  	)
  2431  
  2432  	return
  2433  }
  2434  
  2435  // HasFuncOpen returns true if the function "WEBEXT.downloads.open" exists.
  2436  func HasFuncOpen() bool {
  2437  	return js.True == bindings.HasFuncOpen()
  2438  }
  2439  
  2440  // FuncOpen returns the function "WEBEXT.downloads.open".
  2441  func FuncOpen() (fn js.Func[func(downloadId int32)]) {
  2442  	bindings.FuncOpen(
  2443  		js.Pointer(&fn),
  2444  	)
  2445  	return
  2446  }
  2447  
  2448  // Open calls the function "WEBEXT.downloads.open" directly.
  2449  func Open(downloadId int32) (ret js.Void) {
  2450  	bindings.CallOpen(
  2451  		js.Pointer(&ret),
  2452  		int32(downloadId),
  2453  	)
  2454  
  2455  	return
  2456  }
  2457  
  2458  // TryOpen calls the function "WEBEXT.downloads.open"
  2459  // in a try/catch block and returns (_, err, ok = false) when it went through
  2460  // the catch clause.
  2461  func TryOpen(downloadId int32) (ret js.Void, exception js.Any, ok bool) {
  2462  	ok = js.True == bindings.TryOpen(
  2463  		js.Pointer(&ret), js.Pointer(&exception),
  2464  		int32(downloadId),
  2465  	)
  2466  
  2467  	return
  2468  }
  2469  
  2470  // HasFuncPause returns true if the function "WEBEXT.downloads.pause" exists.
  2471  func HasFuncPause() bool {
  2472  	return js.True == bindings.HasFuncPause()
  2473  }
  2474  
  2475  // FuncPause returns the function "WEBEXT.downloads.pause".
  2476  func FuncPause() (fn js.Func[func(downloadId int32) js.Promise[js.Void]]) {
  2477  	bindings.FuncPause(
  2478  		js.Pointer(&fn),
  2479  	)
  2480  	return
  2481  }
  2482  
  2483  // Pause calls the function "WEBEXT.downloads.pause" directly.
  2484  func Pause(downloadId int32) (ret js.Promise[js.Void]) {
  2485  	bindings.CallPause(
  2486  		js.Pointer(&ret),
  2487  		int32(downloadId),
  2488  	)
  2489  
  2490  	return
  2491  }
  2492  
  2493  // TryPause calls the function "WEBEXT.downloads.pause"
  2494  // in a try/catch block and returns (_, err, ok = false) when it went through
  2495  // the catch clause.
  2496  func TryPause(downloadId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  2497  	ok = js.True == bindings.TryPause(
  2498  		js.Pointer(&ret), js.Pointer(&exception),
  2499  		int32(downloadId),
  2500  	)
  2501  
  2502  	return
  2503  }
  2504  
  2505  // HasFuncRemoveFile returns true if the function "WEBEXT.downloads.removeFile" exists.
  2506  func HasFuncRemoveFile() bool {
  2507  	return js.True == bindings.HasFuncRemoveFile()
  2508  }
  2509  
  2510  // FuncRemoveFile returns the function "WEBEXT.downloads.removeFile".
  2511  func FuncRemoveFile() (fn js.Func[func(downloadId int32) js.Promise[js.Void]]) {
  2512  	bindings.FuncRemoveFile(
  2513  		js.Pointer(&fn),
  2514  	)
  2515  	return
  2516  }
  2517  
  2518  // RemoveFile calls the function "WEBEXT.downloads.removeFile" directly.
  2519  func RemoveFile(downloadId int32) (ret js.Promise[js.Void]) {
  2520  	bindings.CallRemoveFile(
  2521  		js.Pointer(&ret),
  2522  		int32(downloadId),
  2523  	)
  2524  
  2525  	return
  2526  }
  2527  
  2528  // TryRemoveFile calls the function "WEBEXT.downloads.removeFile"
  2529  // in a try/catch block and returns (_, err, ok = false) when it went through
  2530  // the catch clause.
  2531  func TryRemoveFile(downloadId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  2532  	ok = js.True == bindings.TryRemoveFile(
  2533  		js.Pointer(&ret), js.Pointer(&exception),
  2534  		int32(downloadId),
  2535  	)
  2536  
  2537  	return
  2538  }
  2539  
  2540  // HasFuncResume returns true if the function "WEBEXT.downloads.resume" exists.
  2541  func HasFuncResume() bool {
  2542  	return js.True == bindings.HasFuncResume()
  2543  }
  2544  
  2545  // FuncResume returns the function "WEBEXT.downloads.resume".
  2546  func FuncResume() (fn js.Func[func(downloadId int32) js.Promise[js.Void]]) {
  2547  	bindings.FuncResume(
  2548  		js.Pointer(&fn),
  2549  	)
  2550  	return
  2551  }
  2552  
  2553  // Resume calls the function "WEBEXT.downloads.resume" directly.
  2554  func Resume(downloadId int32) (ret js.Promise[js.Void]) {
  2555  	bindings.CallResume(
  2556  		js.Pointer(&ret),
  2557  		int32(downloadId),
  2558  	)
  2559  
  2560  	return
  2561  }
  2562  
  2563  // TryResume calls the function "WEBEXT.downloads.resume"
  2564  // in a try/catch block and returns (_, err, ok = false) when it went through
  2565  // the catch clause.
  2566  func TryResume(downloadId int32) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  2567  	ok = js.True == bindings.TryResume(
  2568  		js.Pointer(&ret), js.Pointer(&exception),
  2569  		int32(downloadId),
  2570  	)
  2571  
  2572  	return
  2573  }
  2574  
  2575  // HasFuncSearch returns true if the function "WEBEXT.downloads.search" exists.
  2576  func HasFuncSearch() bool {
  2577  	return js.True == bindings.HasFuncSearch()
  2578  }
  2579  
  2580  // FuncSearch returns the function "WEBEXT.downloads.search".
  2581  func FuncSearch() (fn js.Func[func(query DownloadQuery) js.Promise[js.Array[DownloadItem]]]) {
  2582  	bindings.FuncSearch(
  2583  		js.Pointer(&fn),
  2584  	)
  2585  	return
  2586  }
  2587  
  2588  // Search calls the function "WEBEXT.downloads.search" directly.
  2589  func Search(query DownloadQuery) (ret js.Promise[js.Array[DownloadItem]]) {
  2590  	bindings.CallSearch(
  2591  		js.Pointer(&ret),
  2592  		js.Pointer(&query),
  2593  	)
  2594  
  2595  	return
  2596  }
  2597  
  2598  // TrySearch calls the function "WEBEXT.downloads.search"
  2599  // in a try/catch block and returns (_, err, ok = false) when it went through
  2600  // the catch clause.
  2601  func TrySearch(query DownloadQuery) (ret js.Promise[js.Array[DownloadItem]], exception js.Any, ok bool) {
  2602  	ok = js.True == bindings.TrySearch(
  2603  		js.Pointer(&ret), js.Pointer(&exception),
  2604  		js.Pointer(&query),
  2605  	)
  2606  
  2607  	return
  2608  }
  2609  
  2610  // HasFuncSetShelfEnabled returns true if the function "WEBEXT.downloads.setShelfEnabled" exists.
  2611  func HasFuncSetShelfEnabled() bool {
  2612  	return js.True == bindings.HasFuncSetShelfEnabled()
  2613  }
  2614  
  2615  // FuncSetShelfEnabled returns the function "WEBEXT.downloads.setShelfEnabled".
  2616  func FuncSetShelfEnabled() (fn js.Func[func(enabled bool)]) {
  2617  	bindings.FuncSetShelfEnabled(
  2618  		js.Pointer(&fn),
  2619  	)
  2620  	return
  2621  }
  2622  
  2623  // SetShelfEnabled calls the function "WEBEXT.downloads.setShelfEnabled" directly.
  2624  func SetShelfEnabled(enabled bool) (ret js.Void) {
  2625  	bindings.CallSetShelfEnabled(
  2626  		js.Pointer(&ret),
  2627  		js.Bool(bool(enabled)),
  2628  	)
  2629  
  2630  	return
  2631  }
  2632  
  2633  // TrySetShelfEnabled calls the function "WEBEXT.downloads.setShelfEnabled"
  2634  // in a try/catch block and returns (_, err, ok = false) when it went through
  2635  // the catch clause.
  2636  func TrySetShelfEnabled(enabled bool) (ret js.Void, exception js.Any, ok bool) {
  2637  	ok = js.True == bindings.TrySetShelfEnabled(
  2638  		js.Pointer(&ret), js.Pointer(&exception),
  2639  		js.Bool(bool(enabled)),
  2640  	)
  2641  
  2642  	return
  2643  }
  2644  
  2645  // HasFuncSetUiOptions returns true if the function "WEBEXT.downloads.setUiOptions" exists.
  2646  func HasFuncSetUiOptions() bool {
  2647  	return js.True == bindings.HasFuncSetUiOptions()
  2648  }
  2649  
  2650  // FuncSetUiOptions returns the function "WEBEXT.downloads.setUiOptions".
  2651  func FuncSetUiOptions() (fn js.Func[func(options UiOptions) js.Promise[js.Void]]) {
  2652  	bindings.FuncSetUiOptions(
  2653  		js.Pointer(&fn),
  2654  	)
  2655  	return
  2656  }
  2657  
  2658  // SetUiOptions calls the function "WEBEXT.downloads.setUiOptions" directly.
  2659  func SetUiOptions(options UiOptions) (ret js.Promise[js.Void]) {
  2660  	bindings.CallSetUiOptions(
  2661  		js.Pointer(&ret),
  2662  		js.Pointer(&options),
  2663  	)
  2664  
  2665  	return
  2666  }
  2667  
  2668  // TrySetUiOptions calls the function "WEBEXT.downloads.setUiOptions"
  2669  // in a try/catch block and returns (_, err, ok = false) when it went through
  2670  // the catch clause.
  2671  func TrySetUiOptions(options UiOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  2672  	ok = js.True == bindings.TrySetUiOptions(
  2673  		js.Pointer(&ret), js.Pointer(&exception),
  2674  		js.Pointer(&options),
  2675  	)
  2676  
  2677  	return
  2678  }
  2679  
  2680  // HasFuncShow returns true if the function "WEBEXT.downloads.show" exists.
  2681  func HasFuncShow() bool {
  2682  	return js.True == bindings.HasFuncShow()
  2683  }
  2684  
  2685  // FuncShow returns the function "WEBEXT.downloads.show".
  2686  func FuncShow() (fn js.Func[func(downloadId int32)]) {
  2687  	bindings.FuncShow(
  2688  		js.Pointer(&fn),
  2689  	)
  2690  	return
  2691  }
  2692  
  2693  // Show calls the function "WEBEXT.downloads.show" directly.
  2694  func Show(downloadId int32) (ret js.Void) {
  2695  	bindings.CallShow(
  2696  		js.Pointer(&ret),
  2697  		int32(downloadId),
  2698  	)
  2699  
  2700  	return
  2701  }
  2702  
  2703  // TryShow calls the function "WEBEXT.downloads.show"
  2704  // in a try/catch block and returns (_, err, ok = false) when it went through
  2705  // the catch clause.
  2706  func TryShow(downloadId int32) (ret js.Void, exception js.Any, ok bool) {
  2707  	ok = js.True == bindings.TryShow(
  2708  		js.Pointer(&ret), js.Pointer(&exception),
  2709  		int32(downloadId),
  2710  	)
  2711  
  2712  	return
  2713  }
  2714  
  2715  // HasFuncShowDefaultFolder returns true if the function "WEBEXT.downloads.showDefaultFolder" exists.
  2716  func HasFuncShowDefaultFolder() bool {
  2717  	return js.True == bindings.HasFuncShowDefaultFolder()
  2718  }
  2719  
  2720  // FuncShowDefaultFolder returns the function "WEBEXT.downloads.showDefaultFolder".
  2721  func FuncShowDefaultFolder() (fn js.Func[func()]) {
  2722  	bindings.FuncShowDefaultFolder(
  2723  		js.Pointer(&fn),
  2724  	)
  2725  	return
  2726  }
  2727  
  2728  // ShowDefaultFolder calls the function "WEBEXT.downloads.showDefaultFolder" directly.
  2729  func ShowDefaultFolder() (ret js.Void) {
  2730  	bindings.CallShowDefaultFolder(
  2731  		js.Pointer(&ret),
  2732  	)
  2733  
  2734  	return
  2735  }
  2736  
  2737  // TryShowDefaultFolder calls the function "WEBEXT.downloads.showDefaultFolder"
  2738  // in a try/catch block and returns (_, err, ok = false) when it went through
  2739  // the catch clause.
  2740  func TryShowDefaultFolder() (ret js.Void, exception js.Any, ok bool) {
  2741  	ok = js.True == bindings.TryShowDefaultFolder(
  2742  		js.Pointer(&ret), js.Pointer(&exception),
  2743  	)
  2744  
  2745  	return
  2746  }