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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package wmdesksprivate
     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/wmdesksprivate/bindings"
    11  )
    12  
    13  type Desk struct {
    14  	// DeskUuid is "Desk.deskUuid"
    15  	//
    16  	// Optional
    17  	DeskUuid js.String
    18  	// DeskName is "Desk.deskName"
    19  	//
    20  	// Optional
    21  	DeskName js.String
    22  
    23  	FFI_USE bool
    24  }
    25  
    26  // FromRef calls UpdateFrom and returns a Desk with all fields set.
    27  func (p Desk) FromRef(ref js.Ref) Desk {
    28  	p.UpdateFrom(ref)
    29  	return p
    30  }
    31  
    32  // New creates a new Desk in the application heap.
    33  func (p Desk) New() js.Ref {
    34  	return bindings.DeskJSLoad(
    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 *Desk) UpdateFrom(ref js.Ref) {
    41  	bindings.DeskJSStore(
    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 *Desk) Update(ref js.Ref) {
    48  	bindings.DeskJSLoad(
    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 *Desk) FreeMembers(recursive bool) {
    56  	js.Free(
    57  		p.DeskUuid.Ref(),
    58  		p.DeskName.Ref(),
    59  	)
    60  	p.DeskUuid = p.DeskUuid.FromRef(js.Undefined)
    61  	p.DeskName = p.DeskName.FromRef(js.Undefined)
    62  }
    63  
    64  type DeskIdCallbackFunc func(this js.Ref, deskId js.String) js.Ref
    65  
    66  func (fn DeskIdCallbackFunc) Register() js.Func[func(deskId js.String)] {
    67  	return js.RegisterCallback[func(deskId js.String)](
    68  		fn, abi.FuncPCABIInternal(fn),
    69  	)
    70  }
    71  
    72  func (fn DeskIdCallbackFunc) DispatchCallback(
    73  	targetPC uintptr, ctx *js.CallbackContext,
    74  ) {
    75  	args := ctx.Args()
    76  	if len(args) != 1+1 /* js this */ ||
    77  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    78  		js.ThrowInvalidCallbackInvocation()
    79  	}
    80  
    81  	if ctx.Return(fn(
    82  		args[0],
    83  
    84  		js.String{}.FromRef(args[0+1]),
    85  	)) {
    86  		return
    87  	}
    88  
    89  	js.ThrowCallbackValueNotReturned()
    90  }
    91  
    92  type DeskIdCallback[T any] struct {
    93  	Fn  func(arg T, this js.Ref, deskId js.String) js.Ref
    94  	Arg T
    95  }
    96  
    97  func (cb *DeskIdCallback[T]) Register() js.Func[func(deskId js.String)] {
    98  	return js.RegisterCallback[func(deskId js.String)](
    99  		cb, abi.FuncPCABIInternal(cb.Fn),
   100  	)
   101  }
   102  
   103  func (cb *DeskIdCallback[T]) DispatchCallback(
   104  	targetPC uintptr, ctx *js.CallbackContext,
   105  ) {
   106  	args := ctx.Args()
   107  	if len(args) != 1+1 /* js this */ ||
   108  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   109  		js.ThrowInvalidCallbackInvocation()
   110  	}
   111  
   112  	if ctx.Return(cb.Fn(
   113  		cb.Arg,
   114  		args[0],
   115  
   116  		js.String{}.FromRef(args[0+1]),
   117  	)) {
   118  		return
   119  	}
   120  
   121  	js.ThrowCallbackValueNotReturned()
   122  }
   123  
   124  type GetAllDesksCallbackFunc func(this js.Ref, desks js.Array[Desk]) js.Ref
   125  
   126  func (fn GetAllDesksCallbackFunc) Register() js.Func[func(desks js.Array[Desk])] {
   127  	return js.RegisterCallback[func(desks js.Array[Desk])](
   128  		fn, abi.FuncPCABIInternal(fn),
   129  	)
   130  }
   131  
   132  func (fn GetAllDesksCallbackFunc) DispatchCallback(
   133  	targetPC uintptr, ctx *js.CallbackContext,
   134  ) {
   135  	args := ctx.Args()
   136  	if len(args) != 1+1 /* js this */ ||
   137  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   138  		js.ThrowInvalidCallbackInvocation()
   139  	}
   140  
   141  	if ctx.Return(fn(
   142  		args[0],
   143  
   144  		js.Array[Desk]{}.FromRef(args[0+1]),
   145  	)) {
   146  		return
   147  	}
   148  
   149  	js.ThrowCallbackValueNotReturned()
   150  }
   151  
   152  type GetAllDesksCallback[T any] struct {
   153  	Fn  func(arg T, this js.Ref, desks js.Array[Desk]) js.Ref
   154  	Arg T
   155  }
   156  
   157  func (cb *GetAllDesksCallback[T]) Register() js.Func[func(desks js.Array[Desk])] {
   158  	return js.RegisterCallback[func(desks js.Array[Desk])](
   159  		cb, abi.FuncPCABIInternal(cb.Fn),
   160  	)
   161  }
   162  
   163  func (cb *GetAllDesksCallback[T]) DispatchCallback(
   164  	targetPC uintptr, ctx *js.CallbackContext,
   165  ) {
   166  	args := ctx.Args()
   167  	if len(args) != 1+1 /* js this */ ||
   168  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   169  		js.ThrowInvalidCallbackInvocation()
   170  	}
   171  
   172  	if ctx.Return(cb.Fn(
   173  		cb.Arg,
   174  		args[0],
   175  
   176  		js.Array[Desk]{}.FromRef(args[0+1]),
   177  	)) {
   178  		return
   179  	}
   180  
   181  	js.ThrowCallbackValueNotReturned()
   182  }
   183  
   184  type GetDeskByIDCallbackFunc func(this js.Ref, desk *Desk) js.Ref
   185  
   186  func (fn GetDeskByIDCallbackFunc) Register() js.Func[func(desk *Desk)] {
   187  	return js.RegisterCallback[func(desk *Desk)](
   188  		fn, abi.FuncPCABIInternal(fn),
   189  	)
   190  }
   191  
   192  func (fn GetDeskByIDCallbackFunc) DispatchCallback(
   193  	targetPC uintptr, ctx *js.CallbackContext,
   194  ) {
   195  	args := ctx.Args()
   196  	if len(args) != 1+1 /* js this */ ||
   197  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   198  		js.ThrowInvalidCallbackInvocation()
   199  	}
   200  	var arg0 Desk
   201  	arg0.UpdateFrom(args[0+1])
   202  	defer arg0.FreeMembers(true)
   203  
   204  	if ctx.Return(fn(
   205  		args[0],
   206  
   207  		mark.NoEscape(&arg0),
   208  	)) {
   209  		return
   210  	}
   211  
   212  	js.ThrowCallbackValueNotReturned()
   213  }
   214  
   215  type GetDeskByIDCallback[T any] struct {
   216  	Fn  func(arg T, this js.Ref, desk *Desk) js.Ref
   217  	Arg T
   218  }
   219  
   220  func (cb *GetDeskByIDCallback[T]) Register() js.Func[func(desk *Desk)] {
   221  	return js.RegisterCallback[func(desk *Desk)](
   222  		cb, abi.FuncPCABIInternal(cb.Fn),
   223  	)
   224  }
   225  
   226  func (cb *GetDeskByIDCallback[T]) DispatchCallback(
   227  	targetPC uintptr, ctx *js.CallbackContext,
   228  ) {
   229  	args := ctx.Args()
   230  	if len(args) != 1+1 /* js this */ ||
   231  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   232  		js.ThrowInvalidCallbackInvocation()
   233  	}
   234  	var arg0 Desk
   235  	arg0.UpdateFrom(args[0+1])
   236  	defer arg0.FreeMembers(true)
   237  
   238  	if ctx.Return(cb.Fn(
   239  		cb.Arg,
   240  		args[0],
   241  
   242  		mark.NoEscape(&arg0),
   243  	)) {
   244  		return
   245  	}
   246  
   247  	js.ThrowCallbackValueNotReturned()
   248  }
   249  
   250  type GetDeskTemplateJsonCallbackFunc func(this js.Ref, templateJson js.String) js.Ref
   251  
   252  func (fn GetDeskTemplateJsonCallbackFunc) Register() js.Func[func(templateJson js.String)] {
   253  	return js.RegisterCallback[func(templateJson js.String)](
   254  		fn, abi.FuncPCABIInternal(fn),
   255  	)
   256  }
   257  
   258  func (fn GetDeskTemplateJsonCallbackFunc) DispatchCallback(
   259  	targetPC uintptr, ctx *js.CallbackContext,
   260  ) {
   261  	args := ctx.Args()
   262  	if len(args) != 1+1 /* js this */ ||
   263  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   264  		js.ThrowInvalidCallbackInvocation()
   265  	}
   266  
   267  	if ctx.Return(fn(
   268  		args[0],
   269  
   270  		js.String{}.FromRef(args[0+1]),
   271  	)) {
   272  		return
   273  	}
   274  
   275  	js.ThrowCallbackValueNotReturned()
   276  }
   277  
   278  type GetDeskTemplateJsonCallback[T any] struct {
   279  	Fn  func(arg T, this js.Ref, templateJson js.String) js.Ref
   280  	Arg T
   281  }
   282  
   283  func (cb *GetDeskTemplateJsonCallback[T]) Register() js.Func[func(templateJson js.String)] {
   284  	return js.RegisterCallback[func(templateJson js.String)](
   285  		cb, abi.FuncPCABIInternal(cb.Fn),
   286  	)
   287  }
   288  
   289  func (cb *GetDeskTemplateJsonCallback[T]) DispatchCallback(
   290  	targetPC uintptr, ctx *js.CallbackContext,
   291  ) {
   292  	args := ctx.Args()
   293  	if len(args) != 1+1 /* js this */ ||
   294  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   295  		js.ThrowInvalidCallbackInvocation()
   296  	}
   297  
   298  	if ctx.Return(cb.Fn(
   299  		cb.Arg,
   300  		args[0],
   301  
   302  		js.String{}.FromRef(args[0+1]),
   303  	)) {
   304  		return
   305  	}
   306  
   307  	js.ThrowCallbackValueNotReturned()
   308  }
   309  
   310  type GetSavedDesksCallbackFunc func(this js.Ref, saveDesks js.Array[SavedDesk]) js.Ref
   311  
   312  func (fn GetSavedDesksCallbackFunc) Register() js.Func[func(saveDesks js.Array[SavedDesk])] {
   313  	return js.RegisterCallback[func(saveDesks js.Array[SavedDesk])](
   314  		fn, abi.FuncPCABIInternal(fn),
   315  	)
   316  }
   317  
   318  func (fn GetSavedDesksCallbackFunc) DispatchCallback(
   319  	targetPC uintptr, ctx *js.CallbackContext,
   320  ) {
   321  	args := ctx.Args()
   322  	if len(args) != 1+1 /* js this */ ||
   323  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   324  		js.ThrowInvalidCallbackInvocation()
   325  	}
   326  
   327  	if ctx.Return(fn(
   328  		args[0],
   329  
   330  		js.Array[SavedDesk]{}.FromRef(args[0+1]),
   331  	)) {
   332  		return
   333  	}
   334  
   335  	js.ThrowCallbackValueNotReturned()
   336  }
   337  
   338  type GetSavedDesksCallback[T any] struct {
   339  	Fn  func(arg T, this js.Ref, saveDesks js.Array[SavedDesk]) js.Ref
   340  	Arg T
   341  }
   342  
   343  func (cb *GetSavedDesksCallback[T]) Register() js.Func[func(saveDesks js.Array[SavedDesk])] {
   344  	return js.RegisterCallback[func(saveDesks js.Array[SavedDesk])](
   345  		cb, abi.FuncPCABIInternal(cb.Fn),
   346  	)
   347  }
   348  
   349  func (cb *GetSavedDesksCallback[T]) DispatchCallback(
   350  	targetPC uintptr, ctx *js.CallbackContext,
   351  ) {
   352  	args := ctx.Args()
   353  	if len(args) != 1+1 /* js this */ ||
   354  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   355  		js.ThrowInvalidCallbackInvocation()
   356  	}
   357  
   358  	if ctx.Return(cb.Fn(
   359  		cb.Arg,
   360  		args[0],
   361  
   362  		js.Array[SavedDesk]{}.FromRef(args[0+1]),
   363  	)) {
   364  		return
   365  	}
   366  
   367  	js.ThrowCallbackValueNotReturned()
   368  }
   369  
   370  type SavedDeskType uint32
   371  
   372  const (
   373  	_ SavedDeskType = iota
   374  
   375  	SavedDeskType_K_TEMPLATE
   376  	SavedDeskType_K_SAVE_AND_RECALL
   377  	SavedDeskType_K_UNKNOWN
   378  )
   379  
   380  func (SavedDeskType) FromRef(str js.Ref) SavedDeskType {
   381  	return SavedDeskType(bindings.ConstOfSavedDeskType(str))
   382  }
   383  
   384  func (x SavedDeskType) String() (string, bool) {
   385  	switch x {
   386  	case SavedDeskType_K_TEMPLATE:
   387  		return "kTemplate", true
   388  	case SavedDeskType_K_SAVE_AND_RECALL:
   389  		return "kSaveAndRecall", true
   390  	case SavedDeskType_K_UNKNOWN:
   391  		return "kUnknown", true
   392  	default:
   393  		return "", false
   394  	}
   395  }
   396  
   397  type SavedDesk struct {
   398  	// SavedDeskUuid is "SavedDesk.savedDeskUuid"
   399  	//
   400  	// Optional
   401  	SavedDeskUuid js.String
   402  	// SavedDeskName is "SavedDesk.savedDeskName"
   403  	//
   404  	// Optional
   405  	SavedDeskName js.String
   406  	// SavedDeskType is "SavedDesk.savedDeskType"
   407  	//
   408  	// Optional
   409  	SavedDeskType SavedDeskType
   410  
   411  	FFI_USE bool
   412  }
   413  
   414  // FromRef calls UpdateFrom and returns a SavedDesk with all fields set.
   415  func (p SavedDesk) FromRef(ref js.Ref) SavedDesk {
   416  	p.UpdateFrom(ref)
   417  	return p
   418  }
   419  
   420  // New creates a new SavedDesk in the application heap.
   421  func (p SavedDesk) New() js.Ref {
   422  	return bindings.SavedDeskJSLoad(
   423  		js.Pointer(&p), js.True, 0,
   424  	)
   425  }
   426  
   427  // UpdateFrom copies value of all fields of the heap object to p.
   428  func (p *SavedDesk) UpdateFrom(ref js.Ref) {
   429  	bindings.SavedDeskJSStore(
   430  		js.Pointer(p), ref,
   431  	)
   432  }
   433  
   434  // Update writes all fields of the p to the heap object referenced by ref.
   435  func (p *SavedDesk) Update(ref js.Ref) {
   436  	bindings.SavedDeskJSLoad(
   437  		js.Pointer(p), js.False, ref,
   438  	)
   439  }
   440  
   441  // FreeMembers frees fields with heap reference, if recursive is true
   442  // free all heap references reachable from p.
   443  func (p *SavedDesk) FreeMembers(recursive bool) {
   444  	js.Free(
   445  		p.SavedDeskUuid.Ref(),
   446  		p.SavedDeskName.Ref(),
   447  	)
   448  	p.SavedDeskUuid = p.SavedDeskUuid.FromRef(js.Undefined)
   449  	p.SavedDeskName = p.SavedDeskName.FromRef(js.Undefined)
   450  }
   451  
   452  type LaunchOptions struct {
   453  	// DeskName is "LaunchOptions.deskName"
   454  	//
   455  	// Optional
   456  	DeskName js.String
   457  
   458  	FFI_USE bool
   459  }
   460  
   461  // FromRef calls UpdateFrom and returns a LaunchOptions with all fields set.
   462  func (p LaunchOptions) FromRef(ref js.Ref) LaunchOptions {
   463  	p.UpdateFrom(ref)
   464  	return p
   465  }
   466  
   467  // New creates a new LaunchOptions in the application heap.
   468  func (p LaunchOptions) New() js.Ref {
   469  	return bindings.LaunchOptionsJSLoad(
   470  		js.Pointer(&p), js.True, 0,
   471  	)
   472  }
   473  
   474  // UpdateFrom copies value of all fields of the heap object to p.
   475  func (p *LaunchOptions) UpdateFrom(ref js.Ref) {
   476  	bindings.LaunchOptionsJSStore(
   477  		js.Pointer(p), ref,
   478  	)
   479  }
   480  
   481  // Update writes all fields of the p to the heap object referenced by ref.
   482  func (p *LaunchOptions) Update(ref js.Ref) {
   483  	bindings.LaunchOptionsJSLoad(
   484  		js.Pointer(p), js.False, ref,
   485  	)
   486  }
   487  
   488  // FreeMembers frees fields with heap reference, if recursive is true
   489  // free all heap references reachable from p.
   490  func (p *LaunchOptions) FreeMembers(recursive bool) {
   491  	js.Free(
   492  		p.DeskName.Ref(),
   493  	)
   494  	p.DeskName = p.DeskName.FromRef(js.Undefined)
   495  }
   496  
   497  type OnDeskAddedEventCallbackFunc func(this js.Ref, deskId js.String, fromUndo bool) js.Ref
   498  
   499  func (fn OnDeskAddedEventCallbackFunc) Register() js.Func[func(deskId js.String, fromUndo bool)] {
   500  	return js.RegisterCallback[func(deskId js.String, fromUndo bool)](
   501  		fn, abi.FuncPCABIInternal(fn),
   502  	)
   503  }
   504  
   505  func (fn OnDeskAddedEventCallbackFunc) DispatchCallback(
   506  	targetPC uintptr, ctx *js.CallbackContext,
   507  ) {
   508  	args := ctx.Args()
   509  	if len(args) != 2+1 /* js this */ ||
   510  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   511  		js.ThrowInvalidCallbackInvocation()
   512  	}
   513  
   514  	if ctx.Return(fn(
   515  		args[0],
   516  
   517  		js.String{}.FromRef(args[0+1]),
   518  		args[1+1] == js.True,
   519  	)) {
   520  		return
   521  	}
   522  
   523  	js.ThrowCallbackValueNotReturned()
   524  }
   525  
   526  type OnDeskAddedEventCallback[T any] struct {
   527  	Fn  func(arg T, this js.Ref, deskId js.String, fromUndo bool) js.Ref
   528  	Arg T
   529  }
   530  
   531  func (cb *OnDeskAddedEventCallback[T]) Register() js.Func[func(deskId js.String, fromUndo bool)] {
   532  	return js.RegisterCallback[func(deskId js.String, fromUndo bool)](
   533  		cb, abi.FuncPCABIInternal(cb.Fn),
   534  	)
   535  }
   536  
   537  func (cb *OnDeskAddedEventCallback[T]) DispatchCallback(
   538  	targetPC uintptr, ctx *js.CallbackContext,
   539  ) {
   540  	args := ctx.Args()
   541  	if len(args) != 2+1 /* js this */ ||
   542  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   543  		js.ThrowInvalidCallbackInvocation()
   544  	}
   545  
   546  	if ctx.Return(cb.Fn(
   547  		cb.Arg,
   548  		args[0],
   549  
   550  		js.String{}.FromRef(args[0+1]),
   551  		args[1+1] == js.True,
   552  	)) {
   553  		return
   554  	}
   555  
   556  	js.ThrowCallbackValueNotReturned()
   557  }
   558  
   559  // HasFuncOnDeskAdded returns true if the function "WEBEXT.wmDesksPrivate.OnDeskAdded.addListener" exists.
   560  func HasFuncOnDeskAdded() bool {
   561  	return js.True == bindings.HasFuncOnDeskAdded()
   562  }
   563  
   564  // FuncOnDeskAdded returns the function "WEBEXT.wmDesksPrivate.OnDeskAdded.addListener".
   565  func FuncOnDeskAdded() (fn js.Func[func(callback js.Func[func(deskId js.String, fromUndo bool)])]) {
   566  	bindings.FuncOnDeskAdded(
   567  		js.Pointer(&fn),
   568  	)
   569  	return
   570  }
   571  
   572  // OnDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.addListener" directly.
   573  func OnDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret js.Void) {
   574  	bindings.CallOnDeskAdded(
   575  		js.Pointer(&ret),
   576  		callback.Ref(),
   577  	)
   578  
   579  	return
   580  }
   581  
   582  // TryOnDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.addListener"
   583  // in a try/catch block and returns (_, err, ok = false) when it went through
   584  // the catch clause.
   585  func TryOnDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret js.Void, exception js.Any, ok bool) {
   586  	ok = js.True == bindings.TryOnDeskAdded(
   587  		js.Pointer(&ret), js.Pointer(&exception),
   588  		callback.Ref(),
   589  	)
   590  
   591  	return
   592  }
   593  
   594  // HasFuncOffDeskAdded returns true if the function "WEBEXT.wmDesksPrivate.OnDeskAdded.removeListener" exists.
   595  func HasFuncOffDeskAdded() bool {
   596  	return js.True == bindings.HasFuncOffDeskAdded()
   597  }
   598  
   599  // FuncOffDeskAdded returns the function "WEBEXT.wmDesksPrivate.OnDeskAdded.removeListener".
   600  func FuncOffDeskAdded() (fn js.Func[func(callback js.Func[func(deskId js.String, fromUndo bool)])]) {
   601  	bindings.FuncOffDeskAdded(
   602  		js.Pointer(&fn),
   603  	)
   604  	return
   605  }
   606  
   607  // OffDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.removeListener" directly.
   608  func OffDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret js.Void) {
   609  	bindings.CallOffDeskAdded(
   610  		js.Pointer(&ret),
   611  		callback.Ref(),
   612  	)
   613  
   614  	return
   615  }
   616  
   617  // TryOffDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.removeListener"
   618  // in a try/catch block and returns (_, err, ok = false) when it went through
   619  // the catch clause.
   620  func TryOffDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret js.Void, exception js.Any, ok bool) {
   621  	ok = js.True == bindings.TryOffDeskAdded(
   622  		js.Pointer(&ret), js.Pointer(&exception),
   623  		callback.Ref(),
   624  	)
   625  
   626  	return
   627  }
   628  
   629  // HasFuncHasOnDeskAdded returns true if the function "WEBEXT.wmDesksPrivate.OnDeskAdded.hasListener" exists.
   630  func HasFuncHasOnDeskAdded() bool {
   631  	return js.True == bindings.HasFuncHasOnDeskAdded()
   632  }
   633  
   634  // FuncHasOnDeskAdded returns the function "WEBEXT.wmDesksPrivate.OnDeskAdded.hasListener".
   635  func FuncHasOnDeskAdded() (fn js.Func[func(callback js.Func[func(deskId js.String, fromUndo bool)]) bool]) {
   636  	bindings.FuncHasOnDeskAdded(
   637  		js.Pointer(&fn),
   638  	)
   639  	return
   640  }
   641  
   642  // HasOnDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.hasListener" directly.
   643  func HasOnDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret bool) {
   644  	bindings.CallHasOnDeskAdded(
   645  		js.Pointer(&ret),
   646  		callback.Ref(),
   647  	)
   648  
   649  	return
   650  }
   651  
   652  // TryHasOnDeskAdded calls the function "WEBEXT.wmDesksPrivate.OnDeskAdded.hasListener"
   653  // in a try/catch block and returns (_, err, ok = false) when it went through
   654  // the catch clause.
   655  func TryHasOnDeskAdded(callback js.Func[func(deskId js.String, fromUndo bool)]) (ret bool, exception js.Any, ok bool) {
   656  	ok = js.True == bindings.TryHasOnDeskAdded(
   657  		js.Pointer(&ret), js.Pointer(&exception),
   658  		callback.Ref(),
   659  	)
   660  
   661  	return
   662  }
   663  
   664  type OnDeskRemovedEventCallbackFunc func(this js.Ref, deskId js.String) js.Ref
   665  
   666  func (fn OnDeskRemovedEventCallbackFunc) Register() js.Func[func(deskId js.String)] {
   667  	return js.RegisterCallback[func(deskId js.String)](
   668  		fn, abi.FuncPCABIInternal(fn),
   669  	)
   670  }
   671  
   672  func (fn OnDeskRemovedEventCallbackFunc) DispatchCallback(
   673  	targetPC uintptr, ctx *js.CallbackContext,
   674  ) {
   675  	args := ctx.Args()
   676  	if len(args) != 1+1 /* js this */ ||
   677  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   678  		js.ThrowInvalidCallbackInvocation()
   679  	}
   680  
   681  	if ctx.Return(fn(
   682  		args[0],
   683  
   684  		js.String{}.FromRef(args[0+1]),
   685  	)) {
   686  		return
   687  	}
   688  
   689  	js.ThrowCallbackValueNotReturned()
   690  }
   691  
   692  type OnDeskRemovedEventCallback[T any] struct {
   693  	Fn  func(arg T, this js.Ref, deskId js.String) js.Ref
   694  	Arg T
   695  }
   696  
   697  func (cb *OnDeskRemovedEventCallback[T]) Register() js.Func[func(deskId js.String)] {
   698  	return js.RegisterCallback[func(deskId js.String)](
   699  		cb, abi.FuncPCABIInternal(cb.Fn),
   700  	)
   701  }
   702  
   703  func (cb *OnDeskRemovedEventCallback[T]) DispatchCallback(
   704  	targetPC uintptr, ctx *js.CallbackContext,
   705  ) {
   706  	args := ctx.Args()
   707  	if len(args) != 1+1 /* js this */ ||
   708  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   709  		js.ThrowInvalidCallbackInvocation()
   710  	}
   711  
   712  	if ctx.Return(cb.Fn(
   713  		cb.Arg,
   714  		args[0],
   715  
   716  		js.String{}.FromRef(args[0+1]),
   717  	)) {
   718  		return
   719  	}
   720  
   721  	js.ThrowCallbackValueNotReturned()
   722  }
   723  
   724  // HasFuncOnDeskRemoved returns true if the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.addListener" exists.
   725  func HasFuncOnDeskRemoved() bool {
   726  	return js.True == bindings.HasFuncOnDeskRemoved()
   727  }
   728  
   729  // FuncOnDeskRemoved returns the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.addListener".
   730  func FuncOnDeskRemoved() (fn js.Func[func(callback js.Func[func(deskId js.String)])]) {
   731  	bindings.FuncOnDeskRemoved(
   732  		js.Pointer(&fn),
   733  	)
   734  	return
   735  }
   736  
   737  // OnDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.addListener" directly.
   738  func OnDeskRemoved(callback js.Func[func(deskId js.String)]) (ret js.Void) {
   739  	bindings.CallOnDeskRemoved(
   740  		js.Pointer(&ret),
   741  		callback.Ref(),
   742  	)
   743  
   744  	return
   745  }
   746  
   747  // TryOnDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.addListener"
   748  // in a try/catch block and returns (_, err, ok = false) when it went through
   749  // the catch clause.
   750  func TryOnDeskRemoved(callback js.Func[func(deskId js.String)]) (ret js.Void, exception js.Any, ok bool) {
   751  	ok = js.True == bindings.TryOnDeskRemoved(
   752  		js.Pointer(&ret), js.Pointer(&exception),
   753  		callback.Ref(),
   754  	)
   755  
   756  	return
   757  }
   758  
   759  // HasFuncOffDeskRemoved returns true if the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.removeListener" exists.
   760  func HasFuncOffDeskRemoved() bool {
   761  	return js.True == bindings.HasFuncOffDeskRemoved()
   762  }
   763  
   764  // FuncOffDeskRemoved returns the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.removeListener".
   765  func FuncOffDeskRemoved() (fn js.Func[func(callback js.Func[func(deskId js.String)])]) {
   766  	bindings.FuncOffDeskRemoved(
   767  		js.Pointer(&fn),
   768  	)
   769  	return
   770  }
   771  
   772  // OffDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.removeListener" directly.
   773  func OffDeskRemoved(callback js.Func[func(deskId js.String)]) (ret js.Void) {
   774  	bindings.CallOffDeskRemoved(
   775  		js.Pointer(&ret),
   776  		callback.Ref(),
   777  	)
   778  
   779  	return
   780  }
   781  
   782  // TryOffDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.removeListener"
   783  // in a try/catch block and returns (_, err, ok = false) when it went through
   784  // the catch clause.
   785  func TryOffDeskRemoved(callback js.Func[func(deskId js.String)]) (ret js.Void, exception js.Any, ok bool) {
   786  	ok = js.True == bindings.TryOffDeskRemoved(
   787  		js.Pointer(&ret), js.Pointer(&exception),
   788  		callback.Ref(),
   789  	)
   790  
   791  	return
   792  }
   793  
   794  // HasFuncHasOnDeskRemoved returns true if the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.hasListener" exists.
   795  func HasFuncHasOnDeskRemoved() bool {
   796  	return js.True == bindings.HasFuncHasOnDeskRemoved()
   797  }
   798  
   799  // FuncHasOnDeskRemoved returns the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.hasListener".
   800  func FuncHasOnDeskRemoved() (fn js.Func[func(callback js.Func[func(deskId js.String)]) bool]) {
   801  	bindings.FuncHasOnDeskRemoved(
   802  		js.Pointer(&fn),
   803  	)
   804  	return
   805  }
   806  
   807  // HasOnDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.hasListener" directly.
   808  func HasOnDeskRemoved(callback js.Func[func(deskId js.String)]) (ret bool) {
   809  	bindings.CallHasOnDeskRemoved(
   810  		js.Pointer(&ret),
   811  		callback.Ref(),
   812  	)
   813  
   814  	return
   815  }
   816  
   817  // TryHasOnDeskRemoved calls the function "WEBEXT.wmDesksPrivate.OnDeskRemoved.hasListener"
   818  // in a try/catch block and returns (_, err, ok = false) when it went through
   819  // the catch clause.
   820  func TryHasOnDeskRemoved(callback js.Func[func(deskId js.String)]) (ret bool, exception js.Any, ok bool) {
   821  	ok = js.True == bindings.TryHasOnDeskRemoved(
   822  		js.Pointer(&ret), js.Pointer(&exception),
   823  		callback.Ref(),
   824  	)
   825  
   826  	return
   827  }
   828  
   829  type OnDeskSwitchedEventCallbackFunc func(this js.Ref, activated js.String, deactivated js.String) js.Ref
   830  
   831  func (fn OnDeskSwitchedEventCallbackFunc) Register() js.Func[func(activated js.String, deactivated js.String)] {
   832  	return js.RegisterCallback[func(activated js.String, deactivated js.String)](
   833  		fn, abi.FuncPCABIInternal(fn),
   834  	)
   835  }
   836  
   837  func (fn OnDeskSwitchedEventCallbackFunc) DispatchCallback(
   838  	targetPC uintptr, ctx *js.CallbackContext,
   839  ) {
   840  	args := ctx.Args()
   841  	if len(args) != 2+1 /* js this */ ||
   842  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   843  		js.ThrowInvalidCallbackInvocation()
   844  	}
   845  
   846  	if ctx.Return(fn(
   847  		args[0],
   848  
   849  		js.String{}.FromRef(args[0+1]),
   850  		js.String{}.FromRef(args[1+1]),
   851  	)) {
   852  		return
   853  	}
   854  
   855  	js.ThrowCallbackValueNotReturned()
   856  }
   857  
   858  type OnDeskSwitchedEventCallback[T any] struct {
   859  	Fn  func(arg T, this js.Ref, activated js.String, deactivated js.String) js.Ref
   860  	Arg T
   861  }
   862  
   863  func (cb *OnDeskSwitchedEventCallback[T]) Register() js.Func[func(activated js.String, deactivated js.String)] {
   864  	return js.RegisterCallback[func(activated js.String, deactivated js.String)](
   865  		cb, abi.FuncPCABIInternal(cb.Fn),
   866  	)
   867  }
   868  
   869  func (cb *OnDeskSwitchedEventCallback[T]) DispatchCallback(
   870  	targetPC uintptr, ctx *js.CallbackContext,
   871  ) {
   872  	args := ctx.Args()
   873  	if len(args) != 2+1 /* js this */ ||
   874  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   875  		js.ThrowInvalidCallbackInvocation()
   876  	}
   877  
   878  	if ctx.Return(cb.Fn(
   879  		cb.Arg,
   880  		args[0],
   881  
   882  		js.String{}.FromRef(args[0+1]),
   883  		js.String{}.FromRef(args[1+1]),
   884  	)) {
   885  		return
   886  	}
   887  
   888  	js.ThrowCallbackValueNotReturned()
   889  }
   890  
   891  // HasFuncOnDeskSwitched returns true if the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.addListener" exists.
   892  func HasFuncOnDeskSwitched() bool {
   893  	return js.True == bindings.HasFuncOnDeskSwitched()
   894  }
   895  
   896  // FuncOnDeskSwitched returns the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.addListener".
   897  func FuncOnDeskSwitched() (fn js.Func[func(callback js.Func[func(activated js.String, deactivated js.String)])]) {
   898  	bindings.FuncOnDeskSwitched(
   899  		js.Pointer(&fn),
   900  	)
   901  	return
   902  }
   903  
   904  // OnDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.addListener" directly.
   905  func OnDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret js.Void) {
   906  	bindings.CallOnDeskSwitched(
   907  		js.Pointer(&ret),
   908  		callback.Ref(),
   909  	)
   910  
   911  	return
   912  }
   913  
   914  // TryOnDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.addListener"
   915  // in a try/catch block and returns (_, err, ok = false) when it went through
   916  // the catch clause.
   917  func TryOnDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret js.Void, exception js.Any, ok bool) {
   918  	ok = js.True == bindings.TryOnDeskSwitched(
   919  		js.Pointer(&ret), js.Pointer(&exception),
   920  		callback.Ref(),
   921  	)
   922  
   923  	return
   924  }
   925  
   926  // HasFuncOffDeskSwitched returns true if the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.removeListener" exists.
   927  func HasFuncOffDeskSwitched() bool {
   928  	return js.True == bindings.HasFuncOffDeskSwitched()
   929  }
   930  
   931  // FuncOffDeskSwitched returns the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.removeListener".
   932  func FuncOffDeskSwitched() (fn js.Func[func(callback js.Func[func(activated js.String, deactivated js.String)])]) {
   933  	bindings.FuncOffDeskSwitched(
   934  		js.Pointer(&fn),
   935  	)
   936  	return
   937  }
   938  
   939  // OffDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.removeListener" directly.
   940  func OffDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret js.Void) {
   941  	bindings.CallOffDeskSwitched(
   942  		js.Pointer(&ret),
   943  		callback.Ref(),
   944  	)
   945  
   946  	return
   947  }
   948  
   949  // TryOffDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.removeListener"
   950  // in a try/catch block and returns (_, err, ok = false) when it went through
   951  // the catch clause.
   952  func TryOffDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret js.Void, exception js.Any, ok bool) {
   953  	ok = js.True == bindings.TryOffDeskSwitched(
   954  		js.Pointer(&ret), js.Pointer(&exception),
   955  		callback.Ref(),
   956  	)
   957  
   958  	return
   959  }
   960  
   961  // HasFuncHasOnDeskSwitched returns true if the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.hasListener" exists.
   962  func HasFuncHasOnDeskSwitched() bool {
   963  	return js.True == bindings.HasFuncHasOnDeskSwitched()
   964  }
   965  
   966  // FuncHasOnDeskSwitched returns the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.hasListener".
   967  func FuncHasOnDeskSwitched() (fn js.Func[func(callback js.Func[func(activated js.String, deactivated js.String)]) bool]) {
   968  	bindings.FuncHasOnDeskSwitched(
   969  		js.Pointer(&fn),
   970  	)
   971  	return
   972  }
   973  
   974  // HasOnDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.hasListener" directly.
   975  func HasOnDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret bool) {
   976  	bindings.CallHasOnDeskSwitched(
   977  		js.Pointer(&ret),
   978  		callback.Ref(),
   979  	)
   980  
   981  	return
   982  }
   983  
   984  // TryHasOnDeskSwitched calls the function "WEBEXT.wmDesksPrivate.OnDeskSwitched.hasListener"
   985  // in a try/catch block and returns (_, err, ok = false) when it went through
   986  // the catch clause.
   987  func TryHasOnDeskSwitched(callback js.Func[func(activated js.String, deactivated js.String)]) (ret bool, exception js.Any, ok bool) {
   988  	ok = js.True == bindings.TryHasOnDeskSwitched(
   989  		js.Pointer(&ret), js.Pointer(&exception),
   990  		callback.Ref(),
   991  	)
   992  
   993  	return
   994  }
   995  
   996  type RemoveDeskOptions struct {
   997  	// CombineDesks is "RemoveDeskOptions.combineDesks"
   998  	//
   999  	// Optional
  1000  	//
  1001  	// NOTE: FFI_USE_CombineDesks MUST be set to true to make this field effective.
  1002  	CombineDesks bool
  1003  	// AllowUndo is "RemoveDeskOptions.allowUndo"
  1004  	//
  1005  	// Optional
  1006  	//
  1007  	// NOTE: FFI_USE_AllowUndo MUST be set to true to make this field effective.
  1008  	AllowUndo bool
  1009  
  1010  	FFI_USE_CombineDesks bool // for CombineDesks.
  1011  	FFI_USE_AllowUndo    bool // for AllowUndo.
  1012  
  1013  	FFI_USE bool
  1014  }
  1015  
  1016  // FromRef calls UpdateFrom and returns a RemoveDeskOptions with all fields set.
  1017  func (p RemoveDeskOptions) FromRef(ref js.Ref) RemoveDeskOptions {
  1018  	p.UpdateFrom(ref)
  1019  	return p
  1020  }
  1021  
  1022  // New creates a new RemoveDeskOptions in the application heap.
  1023  func (p RemoveDeskOptions) New() js.Ref {
  1024  	return bindings.RemoveDeskOptionsJSLoad(
  1025  		js.Pointer(&p), js.True, 0,
  1026  	)
  1027  }
  1028  
  1029  // UpdateFrom copies value of all fields of the heap object to p.
  1030  func (p *RemoveDeskOptions) UpdateFrom(ref js.Ref) {
  1031  	bindings.RemoveDeskOptionsJSStore(
  1032  		js.Pointer(p), ref,
  1033  	)
  1034  }
  1035  
  1036  // Update writes all fields of the p to the heap object referenced by ref.
  1037  func (p *RemoveDeskOptions) Update(ref js.Ref) {
  1038  	bindings.RemoveDeskOptionsJSLoad(
  1039  		js.Pointer(p), js.False, ref,
  1040  	)
  1041  }
  1042  
  1043  // FreeMembers frees fields with heap reference, if recursive is true
  1044  // free all heap references reachable from p.
  1045  func (p *RemoveDeskOptions) FreeMembers(recursive bool) {
  1046  }
  1047  
  1048  type SaveActiveDeskCallbackFunc func(this js.Ref, desk *SavedDesk) js.Ref
  1049  
  1050  func (fn SaveActiveDeskCallbackFunc) Register() js.Func[func(desk *SavedDesk)] {
  1051  	return js.RegisterCallback[func(desk *SavedDesk)](
  1052  		fn, abi.FuncPCABIInternal(fn),
  1053  	)
  1054  }
  1055  
  1056  func (fn SaveActiveDeskCallbackFunc) DispatchCallback(
  1057  	targetPC uintptr, ctx *js.CallbackContext,
  1058  ) {
  1059  	args := ctx.Args()
  1060  	if len(args) != 1+1 /* js this */ ||
  1061  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1062  		js.ThrowInvalidCallbackInvocation()
  1063  	}
  1064  	var arg0 SavedDesk
  1065  	arg0.UpdateFrom(args[0+1])
  1066  	defer arg0.FreeMembers(true)
  1067  
  1068  	if ctx.Return(fn(
  1069  		args[0],
  1070  
  1071  		mark.NoEscape(&arg0),
  1072  	)) {
  1073  		return
  1074  	}
  1075  
  1076  	js.ThrowCallbackValueNotReturned()
  1077  }
  1078  
  1079  type SaveActiveDeskCallback[T any] struct {
  1080  	Fn  func(arg T, this js.Ref, desk *SavedDesk) js.Ref
  1081  	Arg T
  1082  }
  1083  
  1084  func (cb *SaveActiveDeskCallback[T]) Register() js.Func[func(desk *SavedDesk)] {
  1085  	return js.RegisterCallback[func(desk *SavedDesk)](
  1086  		cb, abi.FuncPCABIInternal(cb.Fn),
  1087  	)
  1088  }
  1089  
  1090  func (cb *SaveActiveDeskCallback[T]) DispatchCallback(
  1091  	targetPC uintptr, ctx *js.CallbackContext,
  1092  ) {
  1093  	args := ctx.Args()
  1094  	if len(args) != 1+1 /* js this */ ||
  1095  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1096  		js.ThrowInvalidCallbackInvocation()
  1097  	}
  1098  	var arg0 SavedDesk
  1099  	arg0.UpdateFrom(args[0+1])
  1100  	defer arg0.FreeMembers(true)
  1101  
  1102  	if ctx.Return(cb.Fn(
  1103  		cb.Arg,
  1104  		args[0],
  1105  
  1106  		mark.NoEscape(&arg0),
  1107  	)) {
  1108  		return
  1109  	}
  1110  
  1111  	js.ThrowCallbackValueNotReturned()
  1112  }
  1113  
  1114  type VoidCallbackFunc func(this js.Ref) js.Ref
  1115  
  1116  func (fn VoidCallbackFunc) Register() js.Func[func()] {
  1117  	return js.RegisterCallback[func()](
  1118  		fn, abi.FuncPCABIInternal(fn),
  1119  	)
  1120  }
  1121  
  1122  func (fn VoidCallbackFunc) DispatchCallback(
  1123  	targetPC uintptr, ctx *js.CallbackContext,
  1124  ) {
  1125  	args := ctx.Args()
  1126  	if len(args) != 0+1 /* js this */ ||
  1127  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
  1128  		js.ThrowInvalidCallbackInvocation()
  1129  	}
  1130  
  1131  	if ctx.Return(fn(
  1132  		args[0],
  1133  	)) {
  1134  		return
  1135  	}
  1136  
  1137  	js.ThrowCallbackValueNotReturned()
  1138  }
  1139  
  1140  type VoidCallback[T any] struct {
  1141  	Fn  func(arg T, this js.Ref) js.Ref
  1142  	Arg T
  1143  }
  1144  
  1145  func (cb *VoidCallback[T]) Register() js.Func[func()] {
  1146  	return js.RegisterCallback[func()](
  1147  		cb, abi.FuncPCABIInternal(cb.Fn),
  1148  	)
  1149  }
  1150  
  1151  func (cb *VoidCallback[T]) DispatchCallback(
  1152  	targetPC uintptr, ctx *js.CallbackContext,
  1153  ) {
  1154  	args := ctx.Args()
  1155  	if len(args) != 0+1 /* js this */ ||
  1156  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
  1157  		js.ThrowInvalidCallbackInvocation()
  1158  	}
  1159  
  1160  	if ctx.Return(cb.Fn(
  1161  		cb.Arg,
  1162  		args[0],
  1163  	)) {
  1164  		return
  1165  	}
  1166  
  1167  	js.ThrowCallbackValueNotReturned()
  1168  }
  1169  
  1170  type WindowProperties struct {
  1171  	// AllDesks is "WindowProperties.allDesks"
  1172  	//
  1173  	// Optional
  1174  	//
  1175  	// NOTE: FFI_USE_AllDesks MUST be set to true to make this field effective.
  1176  	AllDesks bool
  1177  
  1178  	FFI_USE_AllDesks bool // for AllDesks.
  1179  
  1180  	FFI_USE bool
  1181  }
  1182  
  1183  // FromRef calls UpdateFrom and returns a WindowProperties with all fields set.
  1184  func (p WindowProperties) FromRef(ref js.Ref) WindowProperties {
  1185  	p.UpdateFrom(ref)
  1186  	return p
  1187  }
  1188  
  1189  // New creates a new WindowProperties in the application heap.
  1190  func (p WindowProperties) New() js.Ref {
  1191  	return bindings.WindowPropertiesJSLoad(
  1192  		js.Pointer(&p), js.True, 0,
  1193  	)
  1194  }
  1195  
  1196  // UpdateFrom copies value of all fields of the heap object to p.
  1197  func (p *WindowProperties) UpdateFrom(ref js.Ref) {
  1198  	bindings.WindowPropertiesJSStore(
  1199  		js.Pointer(p), ref,
  1200  	)
  1201  }
  1202  
  1203  // Update writes all fields of the p to the heap object referenced by ref.
  1204  func (p *WindowProperties) Update(ref js.Ref) {
  1205  	bindings.WindowPropertiesJSLoad(
  1206  		js.Pointer(p), js.False, ref,
  1207  	)
  1208  }
  1209  
  1210  // FreeMembers frees fields with heap reference, if recursive is true
  1211  // free all heap references reachable from p.
  1212  func (p *WindowProperties) FreeMembers(recursive bool) {
  1213  }
  1214  
  1215  // HasFuncDeleteSavedDesk returns true if the function "WEBEXT.wmDesksPrivate.deleteSavedDesk" exists.
  1216  func HasFuncDeleteSavedDesk() bool {
  1217  	return js.True == bindings.HasFuncDeleteSavedDesk()
  1218  }
  1219  
  1220  // FuncDeleteSavedDesk returns the function "WEBEXT.wmDesksPrivate.deleteSavedDesk".
  1221  func FuncDeleteSavedDesk() (fn js.Func[func(savedDeskUuid js.String) js.Promise[js.Void]]) {
  1222  	bindings.FuncDeleteSavedDesk(
  1223  		js.Pointer(&fn),
  1224  	)
  1225  	return
  1226  }
  1227  
  1228  // DeleteSavedDesk calls the function "WEBEXT.wmDesksPrivate.deleteSavedDesk" directly.
  1229  func DeleteSavedDesk(savedDeskUuid js.String) (ret js.Promise[js.Void]) {
  1230  	bindings.CallDeleteSavedDesk(
  1231  		js.Pointer(&ret),
  1232  		savedDeskUuid.Ref(),
  1233  	)
  1234  
  1235  	return
  1236  }
  1237  
  1238  // TryDeleteSavedDesk calls the function "WEBEXT.wmDesksPrivate.deleteSavedDesk"
  1239  // in a try/catch block and returns (_, err, ok = false) when it went through
  1240  // the catch clause.
  1241  func TryDeleteSavedDesk(savedDeskUuid js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1242  	ok = js.True == bindings.TryDeleteSavedDesk(
  1243  		js.Pointer(&ret), js.Pointer(&exception),
  1244  		savedDeskUuid.Ref(),
  1245  	)
  1246  
  1247  	return
  1248  }
  1249  
  1250  // HasFuncGetActiveDesk returns true if the function "WEBEXT.wmDesksPrivate.getActiveDesk" exists.
  1251  func HasFuncGetActiveDesk() bool {
  1252  	return js.True == bindings.HasFuncGetActiveDesk()
  1253  }
  1254  
  1255  // FuncGetActiveDesk returns the function "WEBEXT.wmDesksPrivate.getActiveDesk".
  1256  func FuncGetActiveDesk() (fn js.Func[func() js.Promise[js.String]]) {
  1257  	bindings.FuncGetActiveDesk(
  1258  		js.Pointer(&fn),
  1259  	)
  1260  	return
  1261  }
  1262  
  1263  // GetActiveDesk calls the function "WEBEXT.wmDesksPrivate.getActiveDesk" directly.
  1264  func GetActiveDesk() (ret js.Promise[js.String]) {
  1265  	bindings.CallGetActiveDesk(
  1266  		js.Pointer(&ret),
  1267  	)
  1268  
  1269  	return
  1270  }
  1271  
  1272  // TryGetActiveDesk calls the function "WEBEXT.wmDesksPrivate.getActiveDesk"
  1273  // in a try/catch block and returns (_, err, ok = false) when it went through
  1274  // the catch clause.
  1275  func TryGetActiveDesk() (ret js.Promise[js.String], exception js.Any, ok bool) {
  1276  	ok = js.True == bindings.TryGetActiveDesk(
  1277  		js.Pointer(&ret), js.Pointer(&exception),
  1278  	)
  1279  
  1280  	return
  1281  }
  1282  
  1283  // HasFuncGetAllDesks returns true if the function "WEBEXT.wmDesksPrivate.getAllDesks" exists.
  1284  func HasFuncGetAllDesks() bool {
  1285  	return js.True == bindings.HasFuncGetAllDesks()
  1286  }
  1287  
  1288  // FuncGetAllDesks returns the function "WEBEXT.wmDesksPrivate.getAllDesks".
  1289  func FuncGetAllDesks() (fn js.Func[func() js.Promise[js.Array[Desk]]]) {
  1290  	bindings.FuncGetAllDesks(
  1291  		js.Pointer(&fn),
  1292  	)
  1293  	return
  1294  }
  1295  
  1296  // GetAllDesks calls the function "WEBEXT.wmDesksPrivate.getAllDesks" directly.
  1297  func GetAllDesks() (ret js.Promise[js.Array[Desk]]) {
  1298  	bindings.CallGetAllDesks(
  1299  		js.Pointer(&ret),
  1300  	)
  1301  
  1302  	return
  1303  }
  1304  
  1305  // TryGetAllDesks calls the function "WEBEXT.wmDesksPrivate.getAllDesks"
  1306  // in a try/catch block and returns (_, err, ok = false) when it went through
  1307  // the catch clause.
  1308  func TryGetAllDesks() (ret js.Promise[js.Array[Desk]], exception js.Any, ok bool) {
  1309  	ok = js.True == bindings.TryGetAllDesks(
  1310  		js.Pointer(&ret), js.Pointer(&exception),
  1311  	)
  1312  
  1313  	return
  1314  }
  1315  
  1316  // HasFuncGetDeskByID returns true if the function "WEBEXT.wmDesksPrivate.getDeskByID" exists.
  1317  func HasFuncGetDeskByID() bool {
  1318  	return js.True == bindings.HasFuncGetDeskByID()
  1319  }
  1320  
  1321  // FuncGetDeskByID returns the function "WEBEXT.wmDesksPrivate.getDeskByID".
  1322  func FuncGetDeskByID() (fn js.Func[func(deskUuid js.String) js.Promise[Desk]]) {
  1323  	bindings.FuncGetDeskByID(
  1324  		js.Pointer(&fn),
  1325  	)
  1326  	return
  1327  }
  1328  
  1329  // GetDeskByID calls the function "WEBEXT.wmDesksPrivate.getDeskByID" directly.
  1330  func GetDeskByID(deskUuid js.String) (ret js.Promise[Desk]) {
  1331  	bindings.CallGetDeskByID(
  1332  		js.Pointer(&ret),
  1333  		deskUuid.Ref(),
  1334  	)
  1335  
  1336  	return
  1337  }
  1338  
  1339  // TryGetDeskByID calls the function "WEBEXT.wmDesksPrivate.getDeskByID"
  1340  // in a try/catch block and returns (_, err, ok = false) when it went through
  1341  // the catch clause.
  1342  func TryGetDeskByID(deskUuid js.String) (ret js.Promise[Desk], exception js.Any, ok bool) {
  1343  	ok = js.True == bindings.TryGetDeskByID(
  1344  		js.Pointer(&ret), js.Pointer(&exception),
  1345  		deskUuid.Ref(),
  1346  	)
  1347  
  1348  	return
  1349  }
  1350  
  1351  // HasFuncGetDeskTemplateJson returns true if the function "WEBEXT.wmDesksPrivate.getDeskTemplateJson" exists.
  1352  func HasFuncGetDeskTemplateJson() bool {
  1353  	return js.True == bindings.HasFuncGetDeskTemplateJson()
  1354  }
  1355  
  1356  // FuncGetDeskTemplateJson returns the function "WEBEXT.wmDesksPrivate.getDeskTemplateJson".
  1357  func FuncGetDeskTemplateJson() (fn js.Func[func(templateUuid js.String) js.Promise[js.String]]) {
  1358  	bindings.FuncGetDeskTemplateJson(
  1359  		js.Pointer(&fn),
  1360  	)
  1361  	return
  1362  }
  1363  
  1364  // GetDeskTemplateJson calls the function "WEBEXT.wmDesksPrivate.getDeskTemplateJson" directly.
  1365  func GetDeskTemplateJson(templateUuid js.String) (ret js.Promise[js.String]) {
  1366  	bindings.CallGetDeskTemplateJson(
  1367  		js.Pointer(&ret),
  1368  		templateUuid.Ref(),
  1369  	)
  1370  
  1371  	return
  1372  }
  1373  
  1374  // TryGetDeskTemplateJson calls the function "WEBEXT.wmDesksPrivate.getDeskTemplateJson"
  1375  // in a try/catch block and returns (_, err, ok = false) when it went through
  1376  // the catch clause.
  1377  func TryGetDeskTemplateJson(templateUuid js.String) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1378  	ok = js.True == bindings.TryGetDeskTemplateJson(
  1379  		js.Pointer(&ret), js.Pointer(&exception),
  1380  		templateUuid.Ref(),
  1381  	)
  1382  
  1383  	return
  1384  }
  1385  
  1386  // HasFuncGetSavedDesks returns true if the function "WEBEXT.wmDesksPrivate.getSavedDesks" exists.
  1387  func HasFuncGetSavedDesks() bool {
  1388  	return js.True == bindings.HasFuncGetSavedDesks()
  1389  }
  1390  
  1391  // FuncGetSavedDesks returns the function "WEBEXT.wmDesksPrivate.getSavedDesks".
  1392  func FuncGetSavedDesks() (fn js.Func[func() js.Promise[js.Array[SavedDesk]]]) {
  1393  	bindings.FuncGetSavedDesks(
  1394  		js.Pointer(&fn),
  1395  	)
  1396  	return
  1397  }
  1398  
  1399  // GetSavedDesks calls the function "WEBEXT.wmDesksPrivate.getSavedDesks" directly.
  1400  func GetSavedDesks() (ret js.Promise[js.Array[SavedDesk]]) {
  1401  	bindings.CallGetSavedDesks(
  1402  		js.Pointer(&ret),
  1403  	)
  1404  
  1405  	return
  1406  }
  1407  
  1408  // TryGetSavedDesks calls the function "WEBEXT.wmDesksPrivate.getSavedDesks"
  1409  // in a try/catch block and returns (_, err, ok = false) when it went through
  1410  // the catch clause.
  1411  func TryGetSavedDesks() (ret js.Promise[js.Array[SavedDesk]], exception js.Any, ok bool) {
  1412  	ok = js.True == bindings.TryGetSavedDesks(
  1413  		js.Pointer(&ret), js.Pointer(&exception),
  1414  	)
  1415  
  1416  	return
  1417  }
  1418  
  1419  // HasFuncLaunchDesk returns true if the function "WEBEXT.wmDesksPrivate.launchDesk" exists.
  1420  func HasFuncLaunchDesk() bool {
  1421  	return js.True == bindings.HasFuncLaunchDesk()
  1422  }
  1423  
  1424  // FuncLaunchDesk returns the function "WEBEXT.wmDesksPrivate.launchDesk".
  1425  func FuncLaunchDesk() (fn js.Func[func(launchOptions LaunchOptions) js.Promise[js.String]]) {
  1426  	bindings.FuncLaunchDesk(
  1427  		js.Pointer(&fn),
  1428  	)
  1429  	return
  1430  }
  1431  
  1432  // LaunchDesk calls the function "WEBEXT.wmDesksPrivate.launchDesk" directly.
  1433  func LaunchDesk(launchOptions LaunchOptions) (ret js.Promise[js.String]) {
  1434  	bindings.CallLaunchDesk(
  1435  		js.Pointer(&ret),
  1436  		js.Pointer(&launchOptions),
  1437  	)
  1438  
  1439  	return
  1440  }
  1441  
  1442  // TryLaunchDesk calls the function "WEBEXT.wmDesksPrivate.launchDesk"
  1443  // in a try/catch block and returns (_, err, ok = false) when it went through
  1444  // the catch clause.
  1445  func TryLaunchDesk(launchOptions LaunchOptions) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1446  	ok = js.True == bindings.TryLaunchDesk(
  1447  		js.Pointer(&ret), js.Pointer(&exception),
  1448  		js.Pointer(&launchOptions),
  1449  	)
  1450  
  1451  	return
  1452  }
  1453  
  1454  // HasFuncRecallSavedDesk returns true if the function "WEBEXT.wmDesksPrivate.recallSavedDesk" exists.
  1455  func HasFuncRecallSavedDesk() bool {
  1456  	return js.True == bindings.HasFuncRecallSavedDesk()
  1457  }
  1458  
  1459  // FuncRecallSavedDesk returns the function "WEBEXT.wmDesksPrivate.recallSavedDesk".
  1460  func FuncRecallSavedDesk() (fn js.Func[func(savedDeskUuid js.String) js.Promise[js.String]]) {
  1461  	bindings.FuncRecallSavedDesk(
  1462  		js.Pointer(&fn),
  1463  	)
  1464  	return
  1465  }
  1466  
  1467  // RecallSavedDesk calls the function "WEBEXT.wmDesksPrivate.recallSavedDesk" directly.
  1468  func RecallSavedDesk(savedDeskUuid js.String) (ret js.Promise[js.String]) {
  1469  	bindings.CallRecallSavedDesk(
  1470  		js.Pointer(&ret),
  1471  		savedDeskUuid.Ref(),
  1472  	)
  1473  
  1474  	return
  1475  }
  1476  
  1477  // TryRecallSavedDesk calls the function "WEBEXT.wmDesksPrivate.recallSavedDesk"
  1478  // in a try/catch block and returns (_, err, ok = false) when it went through
  1479  // the catch clause.
  1480  func TryRecallSavedDesk(savedDeskUuid js.String) (ret js.Promise[js.String], exception js.Any, ok bool) {
  1481  	ok = js.True == bindings.TryRecallSavedDesk(
  1482  		js.Pointer(&ret), js.Pointer(&exception),
  1483  		savedDeskUuid.Ref(),
  1484  	)
  1485  
  1486  	return
  1487  }
  1488  
  1489  // HasFuncRemoveDesk returns true if the function "WEBEXT.wmDesksPrivate.removeDesk" exists.
  1490  func HasFuncRemoveDesk() bool {
  1491  	return js.True == bindings.HasFuncRemoveDesk()
  1492  }
  1493  
  1494  // FuncRemoveDesk returns the function "WEBEXT.wmDesksPrivate.removeDesk".
  1495  func FuncRemoveDesk() (fn js.Func[func(deskId js.String, removeDeskOptions RemoveDeskOptions) js.Promise[js.Void]]) {
  1496  	bindings.FuncRemoveDesk(
  1497  		js.Pointer(&fn),
  1498  	)
  1499  	return
  1500  }
  1501  
  1502  // RemoveDesk calls the function "WEBEXT.wmDesksPrivate.removeDesk" directly.
  1503  func RemoveDesk(deskId js.String, removeDeskOptions RemoveDeskOptions) (ret js.Promise[js.Void]) {
  1504  	bindings.CallRemoveDesk(
  1505  		js.Pointer(&ret),
  1506  		deskId.Ref(),
  1507  		js.Pointer(&removeDeskOptions),
  1508  	)
  1509  
  1510  	return
  1511  }
  1512  
  1513  // TryRemoveDesk calls the function "WEBEXT.wmDesksPrivate.removeDesk"
  1514  // in a try/catch block and returns (_, err, ok = false) when it went through
  1515  // the catch clause.
  1516  func TryRemoveDesk(deskId js.String, removeDeskOptions RemoveDeskOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1517  	ok = js.True == bindings.TryRemoveDesk(
  1518  		js.Pointer(&ret), js.Pointer(&exception),
  1519  		deskId.Ref(),
  1520  		js.Pointer(&removeDeskOptions),
  1521  	)
  1522  
  1523  	return
  1524  }
  1525  
  1526  // HasFuncSaveActiveDesk returns true if the function "WEBEXT.wmDesksPrivate.saveActiveDesk" exists.
  1527  func HasFuncSaveActiveDesk() bool {
  1528  	return js.True == bindings.HasFuncSaveActiveDesk()
  1529  }
  1530  
  1531  // FuncSaveActiveDesk returns the function "WEBEXT.wmDesksPrivate.saveActiveDesk".
  1532  func FuncSaveActiveDesk() (fn js.Func[func() js.Promise[SavedDesk]]) {
  1533  	bindings.FuncSaveActiveDesk(
  1534  		js.Pointer(&fn),
  1535  	)
  1536  	return
  1537  }
  1538  
  1539  // SaveActiveDesk calls the function "WEBEXT.wmDesksPrivate.saveActiveDesk" directly.
  1540  func SaveActiveDesk() (ret js.Promise[SavedDesk]) {
  1541  	bindings.CallSaveActiveDesk(
  1542  		js.Pointer(&ret),
  1543  	)
  1544  
  1545  	return
  1546  }
  1547  
  1548  // TrySaveActiveDesk calls the function "WEBEXT.wmDesksPrivate.saveActiveDesk"
  1549  // in a try/catch block and returns (_, err, ok = false) when it went through
  1550  // the catch clause.
  1551  func TrySaveActiveDesk() (ret js.Promise[SavedDesk], exception js.Any, ok bool) {
  1552  	ok = js.True == bindings.TrySaveActiveDesk(
  1553  		js.Pointer(&ret), js.Pointer(&exception),
  1554  	)
  1555  
  1556  	return
  1557  }
  1558  
  1559  // HasFuncSetWindowProperties returns true if the function "WEBEXT.wmDesksPrivate.setWindowProperties" exists.
  1560  func HasFuncSetWindowProperties() bool {
  1561  	return js.True == bindings.HasFuncSetWindowProperties()
  1562  }
  1563  
  1564  // FuncSetWindowProperties returns the function "WEBEXT.wmDesksPrivate.setWindowProperties".
  1565  func FuncSetWindowProperties() (fn js.Func[func(windowId int32, windowProperties WindowProperties) js.Promise[js.Void]]) {
  1566  	bindings.FuncSetWindowProperties(
  1567  		js.Pointer(&fn),
  1568  	)
  1569  	return
  1570  }
  1571  
  1572  // SetWindowProperties calls the function "WEBEXT.wmDesksPrivate.setWindowProperties" directly.
  1573  func SetWindowProperties(windowId int32, windowProperties WindowProperties) (ret js.Promise[js.Void]) {
  1574  	bindings.CallSetWindowProperties(
  1575  		js.Pointer(&ret),
  1576  		int32(windowId),
  1577  		js.Pointer(&windowProperties),
  1578  	)
  1579  
  1580  	return
  1581  }
  1582  
  1583  // TrySetWindowProperties calls the function "WEBEXT.wmDesksPrivate.setWindowProperties"
  1584  // in a try/catch block and returns (_, err, ok = false) when it went through
  1585  // the catch clause.
  1586  func TrySetWindowProperties(windowId int32, windowProperties WindowProperties) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1587  	ok = js.True == bindings.TrySetWindowProperties(
  1588  		js.Pointer(&ret), js.Pointer(&exception),
  1589  		int32(windowId),
  1590  		js.Pointer(&windowProperties),
  1591  	)
  1592  
  1593  	return
  1594  }
  1595  
  1596  // HasFuncSwitchDesk returns true if the function "WEBEXT.wmDesksPrivate.switchDesk" exists.
  1597  func HasFuncSwitchDesk() bool {
  1598  	return js.True == bindings.HasFuncSwitchDesk()
  1599  }
  1600  
  1601  // FuncSwitchDesk returns the function "WEBEXT.wmDesksPrivate.switchDesk".
  1602  func FuncSwitchDesk() (fn js.Func[func(deskUuid js.String) js.Promise[js.Void]]) {
  1603  	bindings.FuncSwitchDesk(
  1604  		js.Pointer(&fn),
  1605  	)
  1606  	return
  1607  }
  1608  
  1609  // SwitchDesk calls the function "WEBEXT.wmDesksPrivate.switchDesk" directly.
  1610  func SwitchDesk(deskUuid js.String) (ret js.Promise[js.Void]) {
  1611  	bindings.CallSwitchDesk(
  1612  		js.Pointer(&ret),
  1613  		deskUuid.Ref(),
  1614  	)
  1615  
  1616  	return
  1617  }
  1618  
  1619  // TrySwitchDesk calls the function "WEBEXT.wmDesksPrivate.switchDesk"
  1620  // in a try/catch block and returns (_, err, ok = false) when it went through
  1621  // the catch clause.
  1622  func TrySwitchDesk(deskUuid js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1623  	ok = js.True == bindings.TrySwitchDesk(
  1624  		js.Pointer(&ret), js.Pointer(&exception),
  1625  		deskUuid.Ref(),
  1626  	)
  1627  
  1628  	return
  1629  }