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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package sidepanel
     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/sidepanel/bindings"
    11  )
    12  
    13  type GetPanelOptions struct {
    14  	// TabId is "GetPanelOptions.tabId"
    15  	//
    16  	// Optional
    17  	//
    18  	// NOTE: FFI_USE_TabId MUST be set to true to make this field effective.
    19  	TabId int32
    20  
    21  	FFI_USE_TabId bool // for TabId.
    22  
    23  	FFI_USE bool
    24  }
    25  
    26  // FromRef calls UpdateFrom and returns a GetPanelOptions with all fields set.
    27  func (p GetPanelOptions) FromRef(ref js.Ref) GetPanelOptions {
    28  	p.UpdateFrom(ref)
    29  	return p
    30  }
    31  
    32  // New creates a new GetPanelOptions in the application heap.
    33  func (p GetPanelOptions) New() js.Ref {
    34  	return bindings.GetPanelOptionsJSLoad(
    35  		js.Pointer(&p), js.True, 0,
    36  	)
    37  }
    38  
    39  // UpdateFrom copies value of all fields of the heap object to p.
    40  func (p *GetPanelOptions) UpdateFrom(ref js.Ref) {
    41  	bindings.GetPanelOptionsJSStore(
    42  		js.Pointer(p), ref,
    43  	)
    44  }
    45  
    46  // Update writes all fields of the p to the heap object referenced by ref.
    47  func (p *GetPanelOptions) Update(ref js.Ref) {
    48  	bindings.GetPanelOptionsJSLoad(
    49  		js.Pointer(p), js.False, ref,
    50  	)
    51  }
    52  
    53  // FreeMembers frees fields with heap reference, if recursive is true
    54  // free all heap references reachable from p.
    55  func (p *GetPanelOptions) FreeMembers(recursive bool) {
    56  }
    57  
    58  type SidePanel struct {
    59  	// DefaultPath is "SidePanel.default_path"
    60  	//
    61  	// Optional
    62  	DefaultPath js.String
    63  
    64  	FFI_USE bool
    65  }
    66  
    67  // FromRef calls UpdateFrom and returns a SidePanel with all fields set.
    68  func (p SidePanel) FromRef(ref js.Ref) SidePanel {
    69  	p.UpdateFrom(ref)
    70  	return p
    71  }
    72  
    73  // New creates a new SidePanel in the application heap.
    74  func (p SidePanel) New() js.Ref {
    75  	return bindings.SidePanelJSLoad(
    76  		js.Pointer(&p), js.True, 0,
    77  	)
    78  }
    79  
    80  // UpdateFrom copies value of all fields of the heap object to p.
    81  func (p *SidePanel) UpdateFrom(ref js.Ref) {
    82  	bindings.SidePanelJSStore(
    83  		js.Pointer(p), ref,
    84  	)
    85  }
    86  
    87  // Update writes all fields of the p to the heap object referenced by ref.
    88  func (p *SidePanel) Update(ref js.Ref) {
    89  	bindings.SidePanelJSLoad(
    90  		js.Pointer(p), js.False, ref,
    91  	)
    92  }
    93  
    94  // FreeMembers frees fields with heap reference, if recursive is true
    95  // free all heap references reachable from p.
    96  func (p *SidePanel) FreeMembers(recursive bool) {
    97  	js.Free(
    98  		p.DefaultPath.Ref(),
    99  	)
   100  	p.DefaultPath = p.DefaultPath.FromRef(js.Undefined)
   101  }
   102  
   103  type ManifestKeys struct {
   104  	// SidePanel is "ManifestKeys.side_panel"
   105  	//
   106  	// Optional
   107  	//
   108  	// NOTE: SidePanel.FFI_USE MUST be set to true to get SidePanel used.
   109  	SidePanel SidePanel
   110  
   111  	FFI_USE bool
   112  }
   113  
   114  // FromRef calls UpdateFrom and returns a ManifestKeys with all fields set.
   115  func (p ManifestKeys) FromRef(ref js.Ref) ManifestKeys {
   116  	p.UpdateFrom(ref)
   117  	return p
   118  }
   119  
   120  // New creates a new ManifestKeys in the application heap.
   121  func (p ManifestKeys) New() js.Ref {
   122  	return bindings.ManifestKeysJSLoad(
   123  		js.Pointer(&p), js.True, 0,
   124  	)
   125  }
   126  
   127  // UpdateFrom copies value of all fields of the heap object to p.
   128  func (p *ManifestKeys) UpdateFrom(ref js.Ref) {
   129  	bindings.ManifestKeysJSStore(
   130  		js.Pointer(p), ref,
   131  	)
   132  }
   133  
   134  // Update writes all fields of the p to the heap object referenced by ref.
   135  func (p *ManifestKeys) Update(ref js.Ref) {
   136  	bindings.ManifestKeysJSLoad(
   137  		js.Pointer(p), js.False, ref,
   138  	)
   139  }
   140  
   141  // FreeMembers frees fields with heap reference, if recursive is true
   142  // free all heap references reachable from p.
   143  func (p *ManifestKeys) FreeMembers(recursive bool) {
   144  	if recursive {
   145  		p.SidePanel.FreeMembers(true)
   146  	}
   147  }
   148  
   149  type OpenOptions struct {
   150  	// WindowId is "OpenOptions.windowId"
   151  	//
   152  	// Optional
   153  	//
   154  	// NOTE: FFI_USE_WindowId MUST be set to true to make this field effective.
   155  	WindowId int32
   156  	// TabId is "OpenOptions.tabId"
   157  	//
   158  	// Optional
   159  	//
   160  	// NOTE: FFI_USE_TabId MUST be set to true to make this field effective.
   161  	TabId int32
   162  
   163  	FFI_USE_WindowId bool // for WindowId.
   164  	FFI_USE_TabId    bool // for TabId.
   165  
   166  	FFI_USE bool
   167  }
   168  
   169  // FromRef calls UpdateFrom and returns a OpenOptions with all fields set.
   170  func (p OpenOptions) FromRef(ref js.Ref) OpenOptions {
   171  	p.UpdateFrom(ref)
   172  	return p
   173  }
   174  
   175  // New creates a new OpenOptions in the application heap.
   176  func (p OpenOptions) New() js.Ref {
   177  	return bindings.OpenOptionsJSLoad(
   178  		js.Pointer(&p), js.True, 0,
   179  	)
   180  }
   181  
   182  // UpdateFrom copies value of all fields of the heap object to p.
   183  func (p *OpenOptions) UpdateFrom(ref js.Ref) {
   184  	bindings.OpenOptionsJSStore(
   185  		js.Pointer(p), ref,
   186  	)
   187  }
   188  
   189  // Update writes all fields of the p to the heap object referenced by ref.
   190  func (p *OpenOptions) Update(ref js.Ref) {
   191  	bindings.OpenOptionsJSLoad(
   192  		js.Pointer(p), js.False, ref,
   193  	)
   194  }
   195  
   196  // FreeMembers frees fields with heap reference, if recursive is true
   197  // free all heap references reachable from p.
   198  func (p *OpenOptions) FreeMembers(recursive bool) {
   199  }
   200  
   201  type PanelBehavior struct {
   202  	// OpenPanelOnActionClick is "PanelBehavior.openPanelOnActionClick"
   203  	//
   204  	// Optional
   205  	//
   206  	// NOTE: FFI_USE_OpenPanelOnActionClick MUST be set to true to make this field effective.
   207  	OpenPanelOnActionClick bool
   208  
   209  	FFI_USE_OpenPanelOnActionClick bool // for OpenPanelOnActionClick.
   210  
   211  	FFI_USE bool
   212  }
   213  
   214  // FromRef calls UpdateFrom and returns a PanelBehavior with all fields set.
   215  func (p PanelBehavior) FromRef(ref js.Ref) PanelBehavior {
   216  	p.UpdateFrom(ref)
   217  	return p
   218  }
   219  
   220  // New creates a new PanelBehavior in the application heap.
   221  func (p PanelBehavior) New() js.Ref {
   222  	return bindings.PanelBehaviorJSLoad(
   223  		js.Pointer(&p), js.True, 0,
   224  	)
   225  }
   226  
   227  // UpdateFrom copies value of all fields of the heap object to p.
   228  func (p *PanelBehavior) UpdateFrom(ref js.Ref) {
   229  	bindings.PanelBehaviorJSStore(
   230  		js.Pointer(p), ref,
   231  	)
   232  }
   233  
   234  // Update writes all fields of the p to the heap object referenced by ref.
   235  func (p *PanelBehavior) Update(ref js.Ref) {
   236  	bindings.PanelBehaviorJSLoad(
   237  		js.Pointer(p), js.False, ref,
   238  	)
   239  }
   240  
   241  // FreeMembers frees fields with heap reference, if recursive is true
   242  // free all heap references reachable from p.
   243  func (p *PanelBehavior) FreeMembers(recursive bool) {
   244  }
   245  
   246  type PanelBehaviorCallbackFunc func(this js.Ref, behavior *PanelBehavior) js.Ref
   247  
   248  func (fn PanelBehaviorCallbackFunc) Register() js.Func[func(behavior *PanelBehavior)] {
   249  	return js.RegisterCallback[func(behavior *PanelBehavior)](
   250  		fn, abi.FuncPCABIInternal(fn),
   251  	)
   252  }
   253  
   254  func (fn PanelBehaviorCallbackFunc) DispatchCallback(
   255  	targetPC uintptr, ctx *js.CallbackContext,
   256  ) {
   257  	args := ctx.Args()
   258  	if len(args) != 1+1 /* js this */ ||
   259  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   260  		js.ThrowInvalidCallbackInvocation()
   261  	}
   262  	var arg0 PanelBehavior
   263  	arg0.UpdateFrom(args[0+1])
   264  	defer arg0.FreeMembers(true)
   265  
   266  	if ctx.Return(fn(
   267  		args[0],
   268  
   269  		mark.NoEscape(&arg0),
   270  	)) {
   271  		return
   272  	}
   273  
   274  	js.ThrowCallbackValueNotReturned()
   275  }
   276  
   277  type PanelBehaviorCallback[T any] struct {
   278  	Fn  func(arg T, this js.Ref, behavior *PanelBehavior) js.Ref
   279  	Arg T
   280  }
   281  
   282  func (cb *PanelBehaviorCallback[T]) Register() js.Func[func(behavior *PanelBehavior)] {
   283  	return js.RegisterCallback[func(behavior *PanelBehavior)](
   284  		cb, abi.FuncPCABIInternal(cb.Fn),
   285  	)
   286  }
   287  
   288  func (cb *PanelBehaviorCallback[T]) DispatchCallback(
   289  	targetPC uintptr, ctx *js.CallbackContext,
   290  ) {
   291  	args := ctx.Args()
   292  	if len(args) != 1+1 /* js this */ ||
   293  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   294  		js.ThrowInvalidCallbackInvocation()
   295  	}
   296  	var arg0 PanelBehavior
   297  	arg0.UpdateFrom(args[0+1])
   298  	defer arg0.FreeMembers(true)
   299  
   300  	if ctx.Return(cb.Fn(
   301  		cb.Arg,
   302  		args[0],
   303  
   304  		mark.NoEscape(&arg0),
   305  	)) {
   306  		return
   307  	}
   308  
   309  	js.ThrowCallbackValueNotReturned()
   310  }
   311  
   312  type PanelOptions struct {
   313  	// TabId is "PanelOptions.tabId"
   314  	//
   315  	// Optional
   316  	//
   317  	// NOTE: FFI_USE_TabId MUST be set to true to make this field effective.
   318  	TabId int32
   319  	// Path is "PanelOptions.path"
   320  	//
   321  	// Optional
   322  	Path js.String
   323  	// Enabled is "PanelOptions.enabled"
   324  	//
   325  	// Optional
   326  	//
   327  	// NOTE: FFI_USE_Enabled MUST be set to true to make this field effective.
   328  	Enabled bool
   329  
   330  	FFI_USE_TabId   bool // for TabId.
   331  	FFI_USE_Enabled bool // for Enabled.
   332  
   333  	FFI_USE bool
   334  }
   335  
   336  // FromRef calls UpdateFrom and returns a PanelOptions with all fields set.
   337  func (p PanelOptions) FromRef(ref js.Ref) PanelOptions {
   338  	p.UpdateFrom(ref)
   339  	return p
   340  }
   341  
   342  // New creates a new PanelOptions in the application heap.
   343  func (p PanelOptions) New() js.Ref {
   344  	return bindings.PanelOptionsJSLoad(
   345  		js.Pointer(&p), js.True, 0,
   346  	)
   347  }
   348  
   349  // UpdateFrom copies value of all fields of the heap object to p.
   350  func (p *PanelOptions) UpdateFrom(ref js.Ref) {
   351  	bindings.PanelOptionsJSStore(
   352  		js.Pointer(p), ref,
   353  	)
   354  }
   355  
   356  // Update writes all fields of the p to the heap object referenced by ref.
   357  func (p *PanelOptions) Update(ref js.Ref) {
   358  	bindings.PanelOptionsJSLoad(
   359  		js.Pointer(p), js.False, ref,
   360  	)
   361  }
   362  
   363  // FreeMembers frees fields with heap reference, if recursive is true
   364  // free all heap references reachable from p.
   365  func (p *PanelOptions) FreeMembers(recursive bool) {
   366  	js.Free(
   367  		p.Path.Ref(),
   368  	)
   369  	p.Path = p.Path.FromRef(js.Undefined)
   370  }
   371  
   372  type PanelOptionsCallbackFunc func(this js.Ref, options *PanelOptions) js.Ref
   373  
   374  func (fn PanelOptionsCallbackFunc) Register() js.Func[func(options *PanelOptions)] {
   375  	return js.RegisterCallback[func(options *PanelOptions)](
   376  		fn, abi.FuncPCABIInternal(fn),
   377  	)
   378  }
   379  
   380  func (fn PanelOptionsCallbackFunc) DispatchCallback(
   381  	targetPC uintptr, ctx *js.CallbackContext,
   382  ) {
   383  	args := ctx.Args()
   384  	if len(args) != 1+1 /* js this */ ||
   385  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   386  		js.ThrowInvalidCallbackInvocation()
   387  	}
   388  	var arg0 PanelOptions
   389  	arg0.UpdateFrom(args[0+1])
   390  	defer arg0.FreeMembers(true)
   391  
   392  	if ctx.Return(fn(
   393  		args[0],
   394  
   395  		mark.NoEscape(&arg0),
   396  	)) {
   397  		return
   398  	}
   399  
   400  	js.ThrowCallbackValueNotReturned()
   401  }
   402  
   403  type PanelOptionsCallback[T any] struct {
   404  	Fn  func(arg T, this js.Ref, options *PanelOptions) js.Ref
   405  	Arg T
   406  }
   407  
   408  func (cb *PanelOptionsCallback[T]) Register() js.Func[func(options *PanelOptions)] {
   409  	return js.RegisterCallback[func(options *PanelOptions)](
   410  		cb, abi.FuncPCABIInternal(cb.Fn),
   411  	)
   412  }
   413  
   414  func (cb *PanelOptionsCallback[T]) DispatchCallback(
   415  	targetPC uintptr, ctx *js.CallbackContext,
   416  ) {
   417  	args := ctx.Args()
   418  	if len(args) != 1+1 /* js this */ ||
   419  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   420  		js.ThrowInvalidCallbackInvocation()
   421  	}
   422  	var arg0 PanelOptions
   423  	arg0.UpdateFrom(args[0+1])
   424  	defer arg0.FreeMembers(true)
   425  
   426  	if ctx.Return(cb.Fn(
   427  		cb.Arg,
   428  		args[0],
   429  
   430  		mark.NoEscape(&arg0),
   431  	)) {
   432  		return
   433  	}
   434  
   435  	js.ThrowCallbackValueNotReturned()
   436  }
   437  
   438  type VoidCallbackFunc func(this js.Ref) js.Ref
   439  
   440  func (fn VoidCallbackFunc) Register() js.Func[func()] {
   441  	return js.RegisterCallback[func()](
   442  		fn, abi.FuncPCABIInternal(fn),
   443  	)
   444  }
   445  
   446  func (fn VoidCallbackFunc) DispatchCallback(
   447  	targetPC uintptr, ctx *js.CallbackContext,
   448  ) {
   449  	args := ctx.Args()
   450  	if len(args) != 0+1 /* js this */ ||
   451  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   452  		js.ThrowInvalidCallbackInvocation()
   453  	}
   454  
   455  	if ctx.Return(fn(
   456  		args[0],
   457  	)) {
   458  		return
   459  	}
   460  
   461  	js.ThrowCallbackValueNotReturned()
   462  }
   463  
   464  type VoidCallback[T any] struct {
   465  	Fn  func(arg T, this js.Ref) js.Ref
   466  	Arg T
   467  }
   468  
   469  func (cb *VoidCallback[T]) Register() js.Func[func()] {
   470  	return js.RegisterCallback[func()](
   471  		cb, abi.FuncPCABIInternal(cb.Fn),
   472  	)
   473  }
   474  
   475  func (cb *VoidCallback[T]) DispatchCallback(
   476  	targetPC uintptr, ctx *js.CallbackContext,
   477  ) {
   478  	args := ctx.Args()
   479  	if len(args) != 0+1 /* js this */ ||
   480  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   481  		js.ThrowInvalidCallbackInvocation()
   482  	}
   483  
   484  	if ctx.Return(cb.Fn(
   485  		cb.Arg,
   486  		args[0],
   487  	)) {
   488  		return
   489  	}
   490  
   491  	js.ThrowCallbackValueNotReturned()
   492  }
   493  
   494  // HasFuncGetOptions returns true if the function "WEBEXT.sidePanel.getOptions" exists.
   495  func HasFuncGetOptions() bool {
   496  	return js.True == bindings.HasFuncGetOptions()
   497  }
   498  
   499  // FuncGetOptions returns the function "WEBEXT.sidePanel.getOptions".
   500  func FuncGetOptions() (fn js.Func[func(options GetPanelOptions) js.Promise[PanelOptions]]) {
   501  	bindings.FuncGetOptions(
   502  		js.Pointer(&fn),
   503  	)
   504  	return
   505  }
   506  
   507  // GetOptions calls the function "WEBEXT.sidePanel.getOptions" directly.
   508  func GetOptions(options GetPanelOptions) (ret js.Promise[PanelOptions]) {
   509  	bindings.CallGetOptions(
   510  		js.Pointer(&ret),
   511  		js.Pointer(&options),
   512  	)
   513  
   514  	return
   515  }
   516  
   517  // TryGetOptions calls the function "WEBEXT.sidePanel.getOptions"
   518  // in a try/catch block and returns (_, err, ok = false) when it went through
   519  // the catch clause.
   520  func TryGetOptions(options GetPanelOptions) (ret js.Promise[PanelOptions], exception js.Any, ok bool) {
   521  	ok = js.True == bindings.TryGetOptions(
   522  		js.Pointer(&ret), js.Pointer(&exception),
   523  		js.Pointer(&options),
   524  	)
   525  
   526  	return
   527  }
   528  
   529  // HasFuncGetPanelBehavior returns true if the function "WEBEXT.sidePanel.getPanelBehavior" exists.
   530  func HasFuncGetPanelBehavior() bool {
   531  	return js.True == bindings.HasFuncGetPanelBehavior()
   532  }
   533  
   534  // FuncGetPanelBehavior returns the function "WEBEXT.sidePanel.getPanelBehavior".
   535  func FuncGetPanelBehavior() (fn js.Func[func() js.Promise[PanelBehavior]]) {
   536  	bindings.FuncGetPanelBehavior(
   537  		js.Pointer(&fn),
   538  	)
   539  	return
   540  }
   541  
   542  // GetPanelBehavior calls the function "WEBEXT.sidePanel.getPanelBehavior" directly.
   543  func GetPanelBehavior() (ret js.Promise[PanelBehavior]) {
   544  	bindings.CallGetPanelBehavior(
   545  		js.Pointer(&ret),
   546  	)
   547  
   548  	return
   549  }
   550  
   551  // TryGetPanelBehavior calls the function "WEBEXT.sidePanel.getPanelBehavior"
   552  // in a try/catch block and returns (_, err, ok = false) when it went through
   553  // the catch clause.
   554  func TryGetPanelBehavior() (ret js.Promise[PanelBehavior], exception js.Any, ok bool) {
   555  	ok = js.True == bindings.TryGetPanelBehavior(
   556  		js.Pointer(&ret), js.Pointer(&exception),
   557  	)
   558  
   559  	return
   560  }
   561  
   562  // HasFuncOpen returns true if the function "WEBEXT.sidePanel.open" exists.
   563  func HasFuncOpen() bool {
   564  	return js.True == bindings.HasFuncOpen()
   565  }
   566  
   567  // FuncOpen returns the function "WEBEXT.sidePanel.open".
   568  func FuncOpen() (fn js.Func[func(options OpenOptions) js.Promise[js.Void]]) {
   569  	bindings.FuncOpen(
   570  		js.Pointer(&fn),
   571  	)
   572  	return
   573  }
   574  
   575  // Open calls the function "WEBEXT.sidePanel.open" directly.
   576  func Open(options OpenOptions) (ret js.Promise[js.Void]) {
   577  	bindings.CallOpen(
   578  		js.Pointer(&ret),
   579  		js.Pointer(&options),
   580  	)
   581  
   582  	return
   583  }
   584  
   585  // TryOpen calls the function "WEBEXT.sidePanel.open"
   586  // in a try/catch block and returns (_, err, ok = false) when it went through
   587  // the catch clause.
   588  func TryOpen(options OpenOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   589  	ok = js.True == bindings.TryOpen(
   590  		js.Pointer(&ret), js.Pointer(&exception),
   591  		js.Pointer(&options),
   592  	)
   593  
   594  	return
   595  }
   596  
   597  // HasFuncSetOptions returns true if the function "WEBEXT.sidePanel.setOptions" exists.
   598  func HasFuncSetOptions() bool {
   599  	return js.True == bindings.HasFuncSetOptions()
   600  }
   601  
   602  // FuncSetOptions returns the function "WEBEXT.sidePanel.setOptions".
   603  func FuncSetOptions() (fn js.Func[func(options PanelOptions) js.Promise[js.Void]]) {
   604  	bindings.FuncSetOptions(
   605  		js.Pointer(&fn),
   606  	)
   607  	return
   608  }
   609  
   610  // SetOptions calls the function "WEBEXT.sidePanel.setOptions" directly.
   611  func SetOptions(options PanelOptions) (ret js.Promise[js.Void]) {
   612  	bindings.CallSetOptions(
   613  		js.Pointer(&ret),
   614  		js.Pointer(&options),
   615  	)
   616  
   617  	return
   618  }
   619  
   620  // TrySetOptions calls the function "WEBEXT.sidePanel.setOptions"
   621  // in a try/catch block and returns (_, err, ok = false) when it went through
   622  // the catch clause.
   623  func TrySetOptions(options PanelOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   624  	ok = js.True == bindings.TrySetOptions(
   625  		js.Pointer(&ret), js.Pointer(&exception),
   626  		js.Pointer(&options),
   627  	)
   628  
   629  	return
   630  }
   631  
   632  // HasFuncSetPanelBehavior returns true if the function "WEBEXT.sidePanel.setPanelBehavior" exists.
   633  func HasFuncSetPanelBehavior() bool {
   634  	return js.True == bindings.HasFuncSetPanelBehavior()
   635  }
   636  
   637  // FuncSetPanelBehavior returns the function "WEBEXT.sidePanel.setPanelBehavior".
   638  func FuncSetPanelBehavior() (fn js.Func[func(behavior PanelBehavior) js.Promise[js.Void]]) {
   639  	bindings.FuncSetPanelBehavior(
   640  		js.Pointer(&fn),
   641  	)
   642  	return
   643  }
   644  
   645  // SetPanelBehavior calls the function "WEBEXT.sidePanel.setPanelBehavior" directly.
   646  func SetPanelBehavior(behavior PanelBehavior) (ret js.Promise[js.Void]) {
   647  	bindings.CallSetPanelBehavior(
   648  		js.Pointer(&ret),
   649  		js.Pointer(&behavior),
   650  	)
   651  
   652  	return
   653  }
   654  
   655  // TrySetPanelBehavior calls the function "WEBEXT.sidePanel.setPanelBehavior"
   656  // in a try/catch block and returns (_, err, ok = false) when it went through
   657  // the catch clause.
   658  func TrySetPanelBehavior(behavior PanelBehavior) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   659  	ok = js.True == bindings.TrySetPanelBehavior(
   660  		js.Pointer(&ret), js.Pointer(&exception),
   661  		js.Pointer(&behavior),
   662  	)
   663  
   664  	return
   665  }