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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package pageaction
     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/pageaction/bindings"
    11  	"github.com/primecitizens/pcz/std/plat/js/webext/tabs"
    12  )
    13  
    14  type ImageDataType struct {
    15  	FFI_USE bool
    16  }
    17  
    18  // FromRef calls UpdateFrom and returns a ImageDataType with all fields set.
    19  func (p ImageDataType) FromRef(ref js.Ref) ImageDataType {
    20  	p.UpdateFrom(ref)
    21  	return p
    22  }
    23  
    24  // New creates a new ImageDataType in the application heap.
    25  func (p ImageDataType) New() js.Ref {
    26  	return bindings.ImageDataTypeJSLoad(
    27  		js.Pointer(&p), js.True, 0,
    28  	)
    29  }
    30  
    31  // UpdateFrom copies value of all fields of the heap object to p.
    32  func (p *ImageDataType) UpdateFrom(ref js.Ref) {
    33  	bindings.ImageDataTypeJSStore(
    34  		js.Pointer(p), ref,
    35  	)
    36  }
    37  
    38  // Update writes all fields of the p to the heap object referenced by ref.
    39  func (p *ImageDataType) Update(ref js.Ref) {
    40  	bindings.ImageDataTypeJSLoad(
    41  		js.Pointer(p), js.False, ref,
    42  	)
    43  }
    44  
    45  // FreeMembers frees fields with heap reference, if recursive is true
    46  // free all heap references reachable from p.
    47  func (p *ImageDataType) FreeMembers(recursive bool) {
    48  }
    49  
    50  type OneOf_ImageDataType_Any struct {
    51  	ref js.Ref
    52  }
    53  
    54  func (x OneOf_ImageDataType_Any) Ref() js.Ref {
    55  	return x.ref
    56  }
    57  
    58  func (x OneOf_ImageDataType_Any) Free() {
    59  	x.ref.Free()
    60  }
    61  
    62  func (x OneOf_ImageDataType_Any) FromRef(ref js.Ref) OneOf_ImageDataType_Any {
    63  	return OneOf_ImageDataType_Any{
    64  		ref: ref,
    65  	}
    66  }
    67  
    68  func (x OneOf_ImageDataType_Any) ImageDataType() ImageDataType {
    69  	var ret ImageDataType
    70  	ret.UpdateFrom(x.ref)
    71  	return ret
    72  }
    73  
    74  func (x OneOf_ImageDataType_Any) Any() js.Any {
    75  	return js.Any{}.FromRef(x.ref)
    76  }
    77  
    78  type OneOf_String_Any struct {
    79  	ref js.Ref
    80  }
    81  
    82  func (x OneOf_String_Any) Ref() js.Ref {
    83  	return x.ref
    84  }
    85  
    86  func (x OneOf_String_Any) Free() {
    87  	x.ref.Free()
    88  }
    89  
    90  func (x OneOf_String_Any) FromRef(ref js.Ref) OneOf_String_Any {
    91  	return OneOf_String_Any{
    92  		ref: ref,
    93  	}
    94  }
    95  
    96  func (x OneOf_String_Any) String() js.String {
    97  	return js.String{}.FromRef(x.ref)
    98  }
    99  
   100  func (x OneOf_String_Any) Any() js.Any {
   101  	return js.Any{}.FromRef(x.ref)
   102  }
   103  
   104  type SetIconArgDetails struct {
   105  	// IconIndex is "SetIconArgDetails.iconIndex"
   106  	//
   107  	// Optional
   108  	//
   109  	// NOTE: FFI_USE_IconIndex MUST be set to true to make this field effective.
   110  	IconIndex int64
   111  	// ImageData is "SetIconArgDetails.imageData"
   112  	//
   113  	// Optional
   114  	ImageData OneOf_ImageDataType_Any
   115  	// Path is "SetIconArgDetails.path"
   116  	//
   117  	// Optional
   118  	Path OneOf_String_Any
   119  	// TabId is "SetIconArgDetails.tabId"
   120  	//
   121  	// Required
   122  	TabId int64
   123  
   124  	FFI_USE_IconIndex bool // for IconIndex.
   125  
   126  	FFI_USE bool
   127  }
   128  
   129  // FromRef calls UpdateFrom and returns a SetIconArgDetails with all fields set.
   130  func (p SetIconArgDetails) FromRef(ref js.Ref) SetIconArgDetails {
   131  	p.UpdateFrom(ref)
   132  	return p
   133  }
   134  
   135  // New creates a new SetIconArgDetails in the application heap.
   136  func (p SetIconArgDetails) New() js.Ref {
   137  	return bindings.SetIconArgDetailsJSLoad(
   138  		js.Pointer(&p), js.True, 0,
   139  	)
   140  }
   141  
   142  // UpdateFrom copies value of all fields of the heap object to p.
   143  func (p *SetIconArgDetails) UpdateFrom(ref js.Ref) {
   144  	bindings.SetIconArgDetailsJSStore(
   145  		js.Pointer(p), ref,
   146  	)
   147  }
   148  
   149  // Update writes all fields of the p to the heap object referenced by ref.
   150  func (p *SetIconArgDetails) Update(ref js.Ref) {
   151  	bindings.SetIconArgDetailsJSLoad(
   152  		js.Pointer(p), js.False, ref,
   153  	)
   154  }
   155  
   156  // FreeMembers frees fields with heap reference, if recursive is true
   157  // free all heap references reachable from p.
   158  func (p *SetIconArgDetails) FreeMembers(recursive bool) {
   159  	js.Free(
   160  		p.ImageData.Ref(),
   161  		p.Path.Ref(),
   162  	)
   163  	p.ImageData = p.ImageData.FromRef(js.Undefined)
   164  	p.Path = p.Path.FromRef(js.Undefined)
   165  }
   166  
   167  type SetPopupArgDetails struct {
   168  	// Popup is "SetPopupArgDetails.popup"
   169  	//
   170  	// Required
   171  	Popup js.String
   172  	// TabId is "SetPopupArgDetails.tabId"
   173  	//
   174  	// Required
   175  	TabId int64
   176  
   177  	FFI_USE bool
   178  }
   179  
   180  // FromRef calls UpdateFrom and returns a SetPopupArgDetails with all fields set.
   181  func (p SetPopupArgDetails) FromRef(ref js.Ref) SetPopupArgDetails {
   182  	p.UpdateFrom(ref)
   183  	return p
   184  }
   185  
   186  // New creates a new SetPopupArgDetails in the application heap.
   187  func (p SetPopupArgDetails) New() js.Ref {
   188  	return bindings.SetPopupArgDetailsJSLoad(
   189  		js.Pointer(&p), js.True, 0,
   190  	)
   191  }
   192  
   193  // UpdateFrom copies value of all fields of the heap object to p.
   194  func (p *SetPopupArgDetails) UpdateFrom(ref js.Ref) {
   195  	bindings.SetPopupArgDetailsJSStore(
   196  		js.Pointer(p), ref,
   197  	)
   198  }
   199  
   200  // Update writes all fields of the p to the heap object referenced by ref.
   201  func (p *SetPopupArgDetails) Update(ref js.Ref) {
   202  	bindings.SetPopupArgDetailsJSLoad(
   203  		js.Pointer(p), js.False, ref,
   204  	)
   205  }
   206  
   207  // FreeMembers frees fields with heap reference, if recursive is true
   208  // free all heap references reachable from p.
   209  func (p *SetPopupArgDetails) FreeMembers(recursive bool) {
   210  	js.Free(
   211  		p.Popup.Ref(),
   212  	)
   213  	p.Popup = p.Popup.FromRef(js.Undefined)
   214  }
   215  
   216  type SetTitleArgDetails struct {
   217  	// TabId is "SetTitleArgDetails.tabId"
   218  	//
   219  	// Required
   220  	TabId int64
   221  	// Title is "SetTitleArgDetails.title"
   222  	//
   223  	// Required
   224  	Title js.String
   225  
   226  	FFI_USE bool
   227  }
   228  
   229  // FromRef calls UpdateFrom and returns a SetTitleArgDetails with all fields set.
   230  func (p SetTitleArgDetails) FromRef(ref js.Ref) SetTitleArgDetails {
   231  	p.UpdateFrom(ref)
   232  	return p
   233  }
   234  
   235  // New creates a new SetTitleArgDetails in the application heap.
   236  func (p SetTitleArgDetails) New() js.Ref {
   237  	return bindings.SetTitleArgDetailsJSLoad(
   238  		js.Pointer(&p), js.True, 0,
   239  	)
   240  }
   241  
   242  // UpdateFrom copies value of all fields of the heap object to p.
   243  func (p *SetTitleArgDetails) UpdateFrom(ref js.Ref) {
   244  	bindings.SetTitleArgDetailsJSStore(
   245  		js.Pointer(p), ref,
   246  	)
   247  }
   248  
   249  // Update writes all fields of the p to the heap object referenced by ref.
   250  func (p *SetTitleArgDetails) Update(ref js.Ref) {
   251  	bindings.SetTitleArgDetailsJSLoad(
   252  		js.Pointer(p), js.False, ref,
   253  	)
   254  }
   255  
   256  // FreeMembers frees fields with heap reference, if recursive is true
   257  // free all heap references reachable from p.
   258  func (p *SetTitleArgDetails) FreeMembers(recursive bool) {
   259  	js.Free(
   260  		p.Title.Ref(),
   261  	)
   262  	p.Title = p.Title.FromRef(js.Undefined)
   263  }
   264  
   265  type TabDetails struct {
   266  	// TabId is "TabDetails.tabId"
   267  	//
   268  	// Optional
   269  	//
   270  	// NOTE: FFI_USE_TabId MUST be set to true to make this field effective.
   271  	TabId int64
   272  
   273  	FFI_USE_TabId bool // for TabId.
   274  
   275  	FFI_USE bool
   276  }
   277  
   278  // FromRef calls UpdateFrom and returns a TabDetails with all fields set.
   279  func (p TabDetails) FromRef(ref js.Ref) TabDetails {
   280  	p.UpdateFrom(ref)
   281  	return p
   282  }
   283  
   284  // New creates a new TabDetails in the application heap.
   285  func (p TabDetails) New() js.Ref {
   286  	return bindings.TabDetailsJSLoad(
   287  		js.Pointer(&p), js.True, 0,
   288  	)
   289  }
   290  
   291  // UpdateFrom copies value of all fields of the heap object to p.
   292  func (p *TabDetails) UpdateFrom(ref js.Ref) {
   293  	bindings.TabDetailsJSStore(
   294  		js.Pointer(p), ref,
   295  	)
   296  }
   297  
   298  // Update writes all fields of the p to the heap object referenced by ref.
   299  func (p *TabDetails) Update(ref js.Ref) {
   300  	bindings.TabDetailsJSLoad(
   301  		js.Pointer(p), js.False, ref,
   302  	)
   303  }
   304  
   305  // FreeMembers frees fields with heap reference, if recursive is true
   306  // free all heap references reachable from p.
   307  func (p *TabDetails) FreeMembers(recursive bool) {
   308  }
   309  
   310  // HasFuncGetPopup returns true if the function "WEBEXT.pageAction.getPopup" exists.
   311  func HasFuncGetPopup() bool {
   312  	return js.True == bindings.HasFuncGetPopup()
   313  }
   314  
   315  // FuncGetPopup returns the function "WEBEXT.pageAction.getPopup".
   316  func FuncGetPopup() (fn js.Func[func(details TabDetails) js.Promise[js.String]]) {
   317  	bindings.FuncGetPopup(
   318  		js.Pointer(&fn),
   319  	)
   320  	return
   321  }
   322  
   323  // GetPopup calls the function "WEBEXT.pageAction.getPopup" directly.
   324  func GetPopup(details TabDetails) (ret js.Promise[js.String]) {
   325  	bindings.CallGetPopup(
   326  		js.Pointer(&ret),
   327  		js.Pointer(&details),
   328  	)
   329  
   330  	return
   331  }
   332  
   333  // TryGetPopup calls the function "WEBEXT.pageAction.getPopup"
   334  // in a try/catch block and returns (_, err, ok = false) when it went through
   335  // the catch clause.
   336  func TryGetPopup(details TabDetails) (ret js.Promise[js.String], exception js.Any, ok bool) {
   337  	ok = js.True == bindings.TryGetPopup(
   338  		js.Pointer(&ret), js.Pointer(&exception),
   339  		js.Pointer(&details),
   340  	)
   341  
   342  	return
   343  }
   344  
   345  // HasFuncGetTitle returns true if the function "WEBEXT.pageAction.getTitle" exists.
   346  func HasFuncGetTitle() bool {
   347  	return js.True == bindings.HasFuncGetTitle()
   348  }
   349  
   350  // FuncGetTitle returns the function "WEBEXT.pageAction.getTitle".
   351  func FuncGetTitle() (fn js.Func[func(details TabDetails) js.Promise[js.String]]) {
   352  	bindings.FuncGetTitle(
   353  		js.Pointer(&fn),
   354  	)
   355  	return
   356  }
   357  
   358  // GetTitle calls the function "WEBEXT.pageAction.getTitle" directly.
   359  func GetTitle(details TabDetails) (ret js.Promise[js.String]) {
   360  	bindings.CallGetTitle(
   361  		js.Pointer(&ret),
   362  		js.Pointer(&details),
   363  	)
   364  
   365  	return
   366  }
   367  
   368  // TryGetTitle calls the function "WEBEXT.pageAction.getTitle"
   369  // in a try/catch block and returns (_, err, ok = false) when it went through
   370  // the catch clause.
   371  func TryGetTitle(details TabDetails) (ret js.Promise[js.String], exception js.Any, ok bool) {
   372  	ok = js.True == bindings.TryGetTitle(
   373  		js.Pointer(&ret), js.Pointer(&exception),
   374  		js.Pointer(&details),
   375  	)
   376  
   377  	return
   378  }
   379  
   380  // HasFuncHide returns true if the function "WEBEXT.pageAction.hide" exists.
   381  func HasFuncHide() bool {
   382  	return js.True == bindings.HasFuncHide()
   383  }
   384  
   385  // FuncHide returns the function "WEBEXT.pageAction.hide".
   386  func FuncHide() (fn js.Func[func(tabId int64) js.Promise[js.Void]]) {
   387  	bindings.FuncHide(
   388  		js.Pointer(&fn),
   389  	)
   390  	return
   391  }
   392  
   393  // Hide calls the function "WEBEXT.pageAction.hide" directly.
   394  func Hide(tabId int64) (ret js.Promise[js.Void]) {
   395  	bindings.CallHide(
   396  		js.Pointer(&ret),
   397  		float64(tabId),
   398  	)
   399  
   400  	return
   401  }
   402  
   403  // TryHide calls the function "WEBEXT.pageAction.hide"
   404  // in a try/catch block and returns (_, err, ok = false) when it went through
   405  // the catch clause.
   406  func TryHide(tabId int64) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   407  	ok = js.True == bindings.TryHide(
   408  		js.Pointer(&ret), js.Pointer(&exception),
   409  		float64(tabId),
   410  	)
   411  
   412  	return
   413  }
   414  
   415  type OnClickedEventCallbackFunc func(this js.Ref, tab *tabs.Tab) js.Ref
   416  
   417  func (fn OnClickedEventCallbackFunc) Register() js.Func[func(tab *tabs.Tab)] {
   418  	return js.RegisterCallback[func(tab *tabs.Tab)](
   419  		fn, abi.FuncPCABIInternal(fn),
   420  	)
   421  }
   422  
   423  func (fn OnClickedEventCallbackFunc) DispatchCallback(
   424  	targetPC uintptr, ctx *js.CallbackContext,
   425  ) {
   426  	args := ctx.Args()
   427  	if len(args) != 1+1 /* js this */ ||
   428  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   429  		js.ThrowInvalidCallbackInvocation()
   430  	}
   431  	var arg0 tabs.Tab
   432  	arg0.UpdateFrom(args[0+1])
   433  	defer arg0.FreeMembers(true)
   434  
   435  	if ctx.Return(fn(
   436  		args[0],
   437  
   438  		mark.NoEscape(&arg0),
   439  	)) {
   440  		return
   441  	}
   442  
   443  	js.ThrowCallbackValueNotReturned()
   444  }
   445  
   446  type OnClickedEventCallback[T any] struct {
   447  	Fn  func(arg T, this js.Ref, tab *tabs.Tab) js.Ref
   448  	Arg T
   449  }
   450  
   451  func (cb *OnClickedEventCallback[T]) Register() js.Func[func(tab *tabs.Tab)] {
   452  	return js.RegisterCallback[func(tab *tabs.Tab)](
   453  		cb, abi.FuncPCABIInternal(cb.Fn),
   454  	)
   455  }
   456  
   457  func (cb *OnClickedEventCallback[T]) DispatchCallback(
   458  	targetPC uintptr, ctx *js.CallbackContext,
   459  ) {
   460  	args := ctx.Args()
   461  	if len(args) != 1+1 /* js this */ ||
   462  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   463  		js.ThrowInvalidCallbackInvocation()
   464  	}
   465  	var arg0 tabs.Tab
   466  	arg0.UpdateFrom(args[0+1])
   467  	defer arg0.FreeMembers(true)
   468  
   469  	if ctx.Return(cb.Fn(
   470  		cb.Arg,
   471  		args[0],
   472  
   473  		mark.NoEscape(&arg0),
   474  	)) {
   475  		return
   476  	}
   477  
   478  	js.ThrowCallbackValueNotReturned()
   479  }
   480  
   481  // HasFuncOnClicked returns true if the function "WEBEXT.pageAction.onClicked.addListener" exists.
   482  func HasFuncOnClicked() bool {
   483  	return js.True == bindings.HasFuncOnClicked()
   484  }
   485  
   486  // FuncOnClicked returns the function "WEBEXT.pageAction.onClicked.addListener".
   487  func FuncOnClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)])]) {
   488  	bindings.FuncOnClicked(
   489  		js.Pointer(&fn),
   490  	)
   491  	return
   492  }
   493  
   494  // OnClicked calls the function "WEBEXT.pageAction.onClicked.addListener" directly.
   495  func OnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void) {
   496  	bindings.CallOnClicked(
   497  		js.Pointer(&ret),
   498  		callback.Ref(),
   499  	)
   500  
   501  	return
   502  }
   503  
   504  // TryOnClicked calls the function "WEBEXT.pageAction.onClicked.addListener"
   505  // in a try/catch block and returns (_, err, ok = false) when it went through
   506  // the catch clause.
   507  func TryOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void, exception js.Any, ok bool) {
   508  	ok = js.True == bindings.TryOnClicked(
   509  		js.Pointer(&ret), js.Pointer(&exception),
   510  		callback.Ref(),
   511  	)
   512  
   513  	return
   514  }
   515  
   516  // HasFuncOffClicked returns true if the function "WEBEXT.pageAction.onClicked.removeListener" exists.
   517  func HasFuncOffClicked() bool {
   518  	return js.True == bindings.HasFuncOffClicked()
   519  }
   520  
   521  // FuncOffClicked returns the function "WEBEXT.pageAction.onClicked.removeListener".
   522  func FuncOffClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)])]) {
   523  	bindings.FuncOffClicked(
   524  		js.Pointer(&fn),
   525  	)
   526  	return
   527  }
   528  
   529  // OffClicked calls the function "WEBEXT.pageAction.onClicked.removeListener" directly.
   530  func OffClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void) {
   531  	bindings.CallOffClicked(
   532  		js.Pointer(&ret),
   533  		callback.Ref(),
   534  	)
   535  
   536  	return
   537  }
   538  
   539  // TryOffClicked calls the function "WEBEXT.pageAction.onClicked.removeListener"
   540  // in a try/catch block and returns (_, err, ok = false) when it went through
   541  // the catch clause.
   542  func TryOffClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void, exception js.Any, ok bool) {
   543  	ok = js.True == bindings.TryOffClicked(
   544  		js.Pointer(&ret), js.Pointer(&exception),
   545  		callback.Ref(),
   546  	)
   547  
   548  	return
   549  }
   550  
   551  // HasFuncHasOnClicked returns true if the function "WEBEXT.pageAction.onClicked.hasListener" exists.
   552  func HasFuncHasOnClicked() bool {
   553  	return js.True == bindings.HasFuncHasOnClicked()
   554  }
   555  
   556  // FuncHasOnClicked returns the function "WEBEXT.pageAction.onClicked.hasListener".
   557  func FuncHasOnClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)]) bool]) {
   558  	bindings.FuncHasOnClicked(
   559  		js.Pointer(&fn),
   560  	)
   561  	return
   562  }
   563  
   564  // HasOnClicked calls the function "WEBEXT.pageAction.onClicked.hasListener" directly.
   565  func HasOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret bool) {
   566  	bindings.CallHasOnClicked(
   567  		js.Pointer(&ret),
   568  		callback.Ref(),
   569  	)
   570  
   571  	return
   572  }
   573  
   574  // TryHasOnClicked calls the function "WEBEXT.pageAction.onClicked.hasListener"
   575  // in a try/catch block and returns (_, err, ok = false) when it went through
   576  // the catch clause.
   577  func TryHasOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret bool, exception js.Any, ok bool) {
   578  	ok = js.True == bindings.TryHasOnClicked(
   579  		js.Pointer(&ret), js.Pointer(&exception),
   580  		callback.Ref(),
   581  	)
   582  
   583  	return
   584  }
   585  
   586  // HasFuncSetIcon returns true if the function "WEBEXT.pageAction.setIcon" exists.
   587  func HasFuncSetIcon() bool {
   588  	return js.True == bindings.HasFuncSetIcon()
   589  }
   590  
   591  // FuncSetIcon returns the function "WEBEXT.pageAction.setIcon".
   592  func FuncSetIcon() (fn js.Func[func(details SetIconArgDetails) js.Promise[js.Void]]) {
   593  	bindings.FuncSetIcon(
   594  		js.Pointer(&fn),
   595  	)
   596  	return
   597  }
   598  
   599  // SetIcon calls the function "WEBEXT.pageAction.setIcon" directly.
   600  func SetIcon(details SetIconArgDetails) (ret js.Promise[js.Void]) {
   601  	bindings.CallSetIcon(
   602  		js.Pointer(&ret),
   603  		js.Pointer(&details),
   604  	)
   605  
   606  	return
   607  }
   608  
   609  // TrySetIcon calls the function "WEBEXT.pageAction.setIcon"
   610  // in a try/catch block and returns (_, err, ok = false) when it went through
   611  // the catch clause.
   612  func TrySetIcon(details SetIconArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   613  	ok = js.True == bindings.TrySetIcon(
   614  		js.Pointer(&ret), js.Pointer(&exception),
   615  		js.Pointer(&details),
   616  	)
   617  
   618  	return
   619  }
   620  
   621  // HasFuncSetPopup returns true if the function "WEBEXT.pageAction.setPopup" exists.
   622  func HasFuncSetPopup() bool {
   623  	return js.True == bindings.HasFuncSetPopup()
   624  }
   625  
   626  // FuncSetPopup returns the function "WEBEXT.pageAction.setPopup".
   627  func FuncSetPopup() (fn js.Func[func(details SetPopupArgDetails) js.Promise[js.Void]]) {
   628  	bindings.FuncSetPopup(
   629  		js.Pointer(&fn),
   630  	)
   631  	return
   632  }
   633  
   634  // SetPopup calls the function "WEBEXT.pageAction.setPopup" directly.
   635  func SetPopup(details SetPopupArgDetails) (ret js.Promise[js.Void]) {
   636  	bindings.CallSetPopup(
   637  		js.Pointer(&ret),
   638  		js.Pointer(&details),
   639  	)
   640  
   641  	return
   642  }
   643  
   644  // TrySetPopup calls the function "WEBEXT.pageAction.setPopup"
   645  // in a try/catch block and returns (_, err, ok = false) when it went through
   646  // the catch clause.
   647  func TrySetPopup(details SetPopupArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   648  	ok = js.True == bindings.TrySetPopup(
   649  		js.Pointer(&ret), js.Pointer(&exception),
   650  		js.Pointer(&details),
   651  	)
   652  
   653  	return
   654  }
   655  
   656  // HasFuncSetTitle returns true if the function "WEBEXT.pageAction.setTitle" exists.
   657  func HasFuncSetTitle() bool {
   658  	return js.True == bindings.HasFuncSetTitle()
   659  }
   660  
   661  // FuncSetTitle returns the function "WEBEXT.pageAction.setTitle".
   662  func FuncSetTitle() (fn js.Func[func(details SetTitleArgDetails) js.Promise[js.Void]]) {
   663  	bindings.FuncSetTitle(
   664  		js.Pointer(&fn),
   665  	)
   666  	return
   667  }
   668  
   669  // SetTitle calls the function "WEBEXT.pageAction.setTitle" directly.
   670  func SetTitle(details SetTitleArgDetails) (ret js.Promise[js.Void]) {
   671  	bindings.CallSetTitle(
   672  		js.Pointer(&ret),
   673  		js.Pointer(&details),
   674  	)
   675  
   676  	return
   677  }
   678  
   679  // TrySetTitle calls the function "WEBEXT.pageAction.setTitle"
   680  // in a try/catch block and returns (_, err, ok = false) when it went through
   681  // the catch clause.
   682  func TrySetTitle(details SetTitleArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   683  	ok = js.True == bindings.TrySetTitle(
   684  		js.Pointer(&ret), js.Pointer(&exception),
   685  		js.Pointer(&details),
   686  	)
   687  
   688  	return
   689  }
   690  
   691  // HasFuncShow returns true if the function "WEBEXT.pageAction.show" exists.
   692  func HasFuncShow() bool {
   693  	return js.True == bindings.HasFuncShow()
   694  }
   695  
   696  // FuncShow returns the function "WEBEXT.pageAction.show".
   697  func FuncShow() (fn js.Func[func(tabId int64) js.Promise[js.Void]]) {
   698  	bindings.FuncShow(
   699  		js.Pointer(&fn),
   700  	)
   701  	return
   702  }
   703  
   704  // Show calls the function "WEBEXT.pageAction.show" directly.
   705  func Show(tabId int64) (ret js.Promise[js.Void]) {
   706  	bindings.CallShow(
   707  		js.Pointer(&ret),
   708  		float64(tabId),
   709  	)
   710  
   711  	return
   712  }
   713  
   714  // TryShow calls the function "WEBEXT.pageAction.show"
   715  // in a try/catch block and returns (_, err, ok = false) when it went through
   716  // the catch clause.
   717  func TryShow(tabId int64) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   718  	ok = js.True == bindings.TryShow(
   719  		js.Pointer(&ret), js.Pointer(&exception),
   720  		float64(tabId),
   721  	)
   722  
   723  	return
   724  }