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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package login
     5  
     6  import (
     7  	"github.com/primecitizens/pcz/std/core/abi"
     8  	"github.com/primecitizens/pcz/std/ffi/js"
     9  	"github.com/primecitizens/pcz/std/plat/js/webext/login/bindings"
    10  )
    11  
    12  type SamlUserSessionProperties struct {
    13  	// Email is "SamlUserSessionProperties.email"
    14  	//
    15  	// Optional
    16  	Email js.String
    17  	// GaiaId is "SamlUserSessionProperties.gaiaId"
    18  	//
    19  	// Optional
    20  	GaiaId js.String
    21  	// Password is "SamlUserSessionProperties.password"
    22  	//
    23  	// Optional
    24  	Password js.String
    25  	// OauthCode is "SamlUserSessionProperties.oauthCode"
    26  	//
    27  	// Optional
    28  	OauthCode js.String
    29  
    30  	FFI_USE bool
    31  }
    32  
    33  // FromRef calls UpdateFrom and returns a SamlUserSessionProperties with all fields set.
    34  func (p SamlUserSessionProperties) FromRef(ref js.Ref) SamlUserSessionProperties {
    35  	p.UpdateFrom(ref)
    36  	return p
    37  }
    38  
    39  // New creates a new SamlUserSessionProperties in the application heap.
    40  func (p SamlUserSessionProperties) New() js.Ref {
    41  	return bindings.SamlUserSessionPropertiesJSLoad(
    42  		js.Pointer(&p), js.True, 0,
    43  	)
    44  }
    45  
    46  // UpdateFrom copies value of all fields of the heap object to p.
    47  func (p *SamlUserSessionProperties) UpdateFrom(ref js.Ref) {
    48  	bindings.SamlUserSessionPropertiesJSStore(
    49  		js.Pointer(p), ref,
    50  	)
    51  }
    52  
    53  // Update writes all fields of the p to the heap object referenced by ref.
    54  func (p *SamlUserSessionProperties) Update(ref js.Ref) {
    55  	bindings.SamlUserSessionPropertiesJSLoad(
    56  		js.Pointer(p), js.False, ref,
    57  	)
    58  }
    59  
    60  // FreeMembers frees fields with heap reference, if recursive is true
    61  // free all heap references reachable from p.
    62  func (p *SamlUserSessionProperties) FreeMembers(recursive bool) {
    63  	js.Free(
    64  		p.Email.Ref(),
    65  		p.GaiaId.Ref(),
    66  		p.Password.Ref(),
    67  		p.OauthCode.Ref(),
    68  	)
    69  	p.Email = p.Email.FromRef(js.Undefined)
    70  	p.GaiaId = p.GaiaId.FromRef(js.Undefined)
    71  	p.Password = p.Password.FromRef(js.Undefined)
    72  	p.OauthCode = p.OauthCode.FromRef(js.Undefined)
    73  }
    74  
    75  type StringCallbackFunc func(this js.Ref, result js.String) js.Ref
    76  
    77  func (fn StringCallbackFunc) Register() js.Func[func(result js.String)] {
    78  	return js.RegisterCallback[func(result js.String)](
    79  		fn, abi.FuncPCABIInternal(fn),
    80  	)
    81  }
    82  
    83  func (fn StringCallbackFunc) DispatchCallback(
    84  	targetPC uintptr, ctx *js.CallbackContext,
    85  ) {
    86  	args := ctx.Args()
    87  	if len(args) != 1+1 /* js this */ ||
    88  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
    89  		js.ThrowInvalidCallbackInvocation()
    90  	}
    91  
    92  	if ctx.Return(fn(
    93  		args[0],
    94  
    95  		js.String{}.FromRef(args[0+1]),
    96  	)) {
    97  		return
    98  	}
    99  
   100  	js.ThrowCallbackValueNotReturned()
   101  }
   102  
   103  type StringCallback[T any] struct {
   104  	Fn  func(arg T, this js.Ref, result js.String) js.Ref
   105  	Arg T
   106  }
   107  
   108  func (cb *StringCallback[T]) Register() js.Func[func(result js.String)] {
   109  	return js.RegisterCallback[func(result js.String)](
   110  		cb, abi.FuncPCABIInternal(cb.Fn),
   111  	)
   112  }
   113  
   114  func (cb *StringCallback[T]) DispatchCallback(
   115  	targetPC uintptr, ctx *js.CallbackContext,
   116  ) {
   117  	args := ctx.Args()
   118  	if len(args) != 1+1 /* js this */ ||
   119  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   120  		js.ThrowInvalidCallbackInvocation()
   121  	}
   122  
   123  	if ctx.Return(cb.Fn(
   124  		cb.Arg,
   125  		args[0],
   126  
   127  		js.String{}.FromRef(args[0+1]),
   128  	)) {
   129  		return
   130  	}
   131  
   132  	js.ThrowCallbackValueNotReturned()
   133  }
   134  
   135  type VoidCallbackFunc func(this js.Ref) js.Ref
   136  
   137  func (fn VoidCallbackFunc) Register() js.Func[func()] {
   138  	return js.RegisterCallback[func()](
   139  		fn, abi.FuncPCABIInternal(fn),
   140  	)
   141  }
   142  
   143  func (fn VoidCallbackFunc) DispatchCallback(
   144  	targetPC uintptr, ctx *js.CallbackContext,
   145  ) {
   146  	args := ctx.Args()
   147  	if len(args) != 0+1 /* js this */ ||
   148  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   149  		js.ThrowInvalidCallbackInvocation()
   150  	}
   151  
   152  	if ctx.Return(fn(
   153  		args[0],
   154  	)) {
   155  		return
   156  	}
   157  
   158  	js.ThrowCallbackValueNotReturned()
   159  }
   160  
   161  type VoidCallback[T any] struct {
   162  	Fn  func(arg T, this js.Ref) js.Ref
   163  	Arg T
   164  }
   165  
   166  func (cb *VoidCallback[T]) Register() js.Func[func()] {
   167  	return js.RegisterCallback[func()](
   168  		cb, abi.FuncPCABIInternal(cb.Fn),
   169  	)
   170  }
   171  
   172  func (cb *VoidCallback[T]) DispatchCallback(
   173  	targetPC uintptr, ctx *js.CallbackContext,
   174  ) {
   175  	args := ctx.Args()
   176  	if len(args) != 0+1 /* js this */ ||
   177  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   178  		js.ThrowInvalidCallbackInvocation()
   179  	}
   180  
   181  	if ctx.Return(cb.Fn(
   182  		cb.Arg,
   183  		args[0],
   184  	)) {
   185  		return
   186  	}
   187  
   188  	js.ThrowCallbackValueNotReturned()
   189  }
   190  
   191  // HasFuncEndSharedSession returns true if the function "WEBEXT.login.endSharedSession" exists.
   192  func HasFuncEndSharedSession() bool {
   193  	return js.True == bindings.HasFuncEndSharedSession()
   194  }
   195  
   196  // FuncEndSharedSession returns the function "WEBEXT.login.endSharedSession".
   197  func FuncEndSharedSession() (fn js.Func[func() js.Promise[js.Void]]) {
   198  	bindings.FuncEndSharedSession(
   199  		js.Pointer(&fn),
   200  	)
   201  	return
   202  }
   203  
   204  // EndSharedSession calls the function "WEBEXT.login.endSharedSession" directly.
   205  func EndSharedSession() (ret js.Promise[js.Void]) {
   206  	bindings.CallEndSharedSession(
   207  		js.Pointer(&ret),
   208  	)
   209  
   210  	return
   211  }
   212  
   213  // TryEndSharedSession calls the function "WEBEXT.login.endSharedSession"
   214  // in a try/catch block and returns (_, err, ok = false) when it went through
   215  // the catch clause.
   216  func TryEndSharedSession() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   217  	ok = js.True == bindings.TryEndSharedSession(
   218  		js.Pointer(&ret), js.Pointer(&exception),
   219  	)
   220  
   221  	return
   222  }
   223  
   224  // HasFuncEnterSharedSession returns true if the function "WEBEXT.login.enterSharedSession" exists.
   225  func HasFuncEnterSharedSession() bool {
   226  	return js.True == bindings.HasFuncEnterSharedSession()
   227  }
   228  
   229  // FuncEnterSharedSession returns the function "WEBEXT.login.enterSharedSession".
   230  func FuncEnterSharedSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   231  	bindings.FuncEnterSharedSession(
   232  		js.Pointer(&fn),
   233  	)
   234  	return
   235  }
   236  
   237  // EnterSharedSession calls the function "WEBEXT.login.enterSharedSession" directly.
   238  func EnterSharedSession(password js.String) (ret js.Promise[js.Void]) {
   239  	bindings.CallEnterSharedSession(
   240  		js.Pointer(&ret),
   241  		password.Ref(),
   242  	)
   243  
   244  	return
   245  }
   246  
   247  // TryEnterSharedSession calls the function "WEBEXT.login.enterSharedSession"
   248  // in a try/catch block and returns (_, err, ok = false) when it went through
   249  // the catch clause.
   250  func TryEnterSharedSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   251  	ok = js.True == bindings.TryEnterSharedSession(
   252  		js.Pointer(&ret), js.Pointer(&exception),
   253  		password.Ref(),
   254  	)
   255  
   256  	return
   257  }
   258  
   259  // HasFuncExitCurrentSession returns true if the function "WEBEXT.login.exitCurrentSession" exists.
   260  func HasFuncExitCurrentSession() bool {
   261  	return js.True == bindings.HasFuncExitCurrentSession()
   262  }
   263  
   264  // FuncExitCurrentSession returns the function "WEBEXT.login.exitCurrentSession".
   265  func FuncExitCurrentSession() (fn js.Func[func(dataForNextLoginAttempt js.String) js.Promise[js.Void]]) {
   266  	bindings.FuncExitCurrentSession(
   267  		js.Pointer(&fn),
   268  	)
   269  	return
   270  }
   271  
   272  // ExitCurrentSession calls the function "WEBEXT.login.exitCurrentSession" directly.
   273  func ExitCurrentSession(dataForNextLoginAttempt js.String) (ret js.Promise[js.Void]) {
   274  	bindings.CallExitCurrentSession(
   275  		js.Pointer(&ret),
   276  		dataForNextLoginAttempt.Ref(),
   277  	)
   278  
   279  	return
   280  }
   281  
   282  // TryExitCurrentSession calls the function "WEBEXT.login.exitCurrentSession"
   283  // in a try/catch block and returns (_, err, ok = false) when it went through
   284  // the catch clause.
   285  func TryExitCurrentSession(dataForNextLoginAttempt js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   286  	ok = js.True == bindings.TryExitCurrentSession(
   287  		js.Pointer(&ret), js.Pointer(&exception),
   288  		dataForNextLoginAttempt.Ref(),
   289  	)
   290  
   291  	return
   292  }
   293  
   294  // HasFuncFetchDataForNextLoginAttempt returns true if the function "WEBEXT.login.fetchDataForNextLoginAttempt" exists.
   295  func HasFuncFetchDataForNextLoginAttempt() bool {
   296  	return js.True == bindings.HasFuncFetchDataForNextLoginAttempt()
   297  }
   298  
   299  // FuncFetchDataForNextLoginAttempt returns the function "WEBEXT.login.fetchDataForNextLoginAttempt".
   300  func FuncFetchDataForNextLoginAttempt() (fn js.Func[func() js.Promise[js.String]]) {
   301  	bindings.FuncFetchDataForNextLoginAttempt(
   302  		js.Pointer(&fn),
   303  	)
   304  	return
   305  }
   306  
   307  // FetchDataForNextLoginAttempt calls the function "WEBEXT.login.fetchDataForNextLoginAttempt" directly.
   308  func FetchDataForNextLoginAttempt() (ret js.Promise[js.String]) {
   309  	bindings.CallFetchDataForNextLoginAttempt(
   310  		js.Pointer(&ret),
   311  	)
   312  
   313  	return
   314  }
   315  
   316  // TryFetchDataForNextLoginAttempt calls the function "WEBEXT.login.fetchDataForNextLoginAttempt"
   317  // in a try/catch block and returns (_, err, ok = false) when it went through
   318  // the catch clause.
   319  func TryFetchDataForNextLoginAttempt() (ret js.Promise[js.String], exception js.Any, ok bool) {
   320  	ok = js.True == bindings.TryFetchDataForNextLoginAttempt(
   321  		js.Pointer(&ret), js.Pointer(&exception),
   322  	)
   323  
   324  	return
   325  }
   326  
   327  // HasFuncLaunchManagedGuestSession returns true if the function "WEBEXT.login.launchManagedGuestSession" exists.
   328  func HasFuncLaunchManagedGuestSession() bool {
   329  	return js.True == bindings.HasFuncLaunchManagedGuestSession()
   330  }
   331  
   332  // FuncLaunchManagedGuestSession returns the function "WEBEXT.login.launchManagedGuestSession".
   333  func FuncLaunchManagedGuestSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   334  	bindings.FuncLaunchManagedGuestSession(
   335  		js.Pointer(&fn),
   336  	)
   337  	return
   338  }
   339  
   340  // LaunchManagedGuestSession calls the function "WEBEXT.login.launchManagedGuestSession" directly.
   341  func LaunchManagedGuestSession(password js.String) (ret js.Promise[js.Void]) {
   342  	bindings.CallLaunchManagedGuestSession(
   343  		js.Pointer(&ret),
   344  		password.Ref(),
   345  	)
   346  
   347  	return
   348  }
   349  
   350  // TryLaunchManagedGuestSession calls the function "WEBEXT.login.launchManagedGuestSession"
   351  // in a try/catch block and returns (_, err, ok = false) when it went through
   352  // the catch clause.
   353  func TryLaunchManagedGuestSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   354  	ok = js.True == bindings.TryLaunchManagedGuestSession(
   355  		js.Pointer(&ret), js.Pointer(&exception),
   356  		password.Ref(),
   357  	)
   358  
   359  	return
   360  }
   361  
   362  // HasFuncLaunchSamlUserSession returns true if the function "WEBEXT.login.launchSamlUserSession" exists.
   363  func HasFuncLaunchSamlUserSession() bool {
   364  	return js.True == bindings.HasFuncLaunchSamlUserSession()
   365  }
   366  
   367  // FuncLaunchSamlUserSession returns the function "WEBEXT.login.launchSamlUserSession".
   368  func FuncLaunchSamlUserSession() (fn js.Func[func(properties SamlUserSessionProperties) js.Promise[js.Void]]) {
   369  	bindings.FuncLaunchSamlUserSession(
   370  		js.Pointer(&fn),
   371  	)
   372  	return
   373  }
   374  
   375  // LaunchSamlUserSession calls the function "WEBEXT.login.launchSamlUserSession" directly.
   376  func LaunchSamlUserSession(properties SamlUserSessionProperties) (ret js.Promise[js.Void]) {
   377  	bindings.CallLaunchSamlUserSession(
   378  		js.Pointer(&ret),
   379  		js.Pointer(&properties),
   380  	)
   381  
   382  	return
   383  }
   384  
   385  // TryLaunchSamlUserSession calls the function "WEBEXT.login.launchSamlUserSession"
   386  // in a try/catch block and returns (_, err, ok = false) when it went through
   387  // the catch clause.
   388  func TryLaunchSamlUserSession(properties SamlUserSessionProperties) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   389  	ok = js.True == bindings.TryLaunchSamlUserSession(
   390  		js.Pointer(&ret), js.Pointer(&exception),
   391  		js.Pointer(&properties),
   392  	)
   393  
   394  	return
   395  }
   396  
   397  // HasFuncLaunchSharedManagedGuestSession returns true if the function "WEBEXT.login.launchSharedManagedGuestSession" exists.
   398  func HasFuncLaunchSharedManagedGuestSession() bool {
   399  	return js.True == bindings.HasFuncLaunchSharedManagedGuestSession()
   400  }
   401  
   402  // FuncLaunchSharedManagedGuestSession returns the function "WEBEXT.login.launchSharedManagedGuestSession".
   403  func FuncLaunchSharedManagedGuestSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   404  	bindings.FuncLaunchSharedManagedGuestSession(
   405  		js.Pointer(&fn),
   406  	)
   407  	return
   408  }
   409  
   410  // LaunchSharedManagedGuestSession calls the function "WEBEXT.login.launchSharedManagedGuestSession" directly.
   411  func LaunchSharedManagedGuestSession(password js.String) (ret js.Promise[js.Void]) {
   412  	bindings.CallLaunchSharedManagedGuestSession(
   413  		js.Pointer(&ret),
   414  		password.Ref(),
   415  	)
   416  
   417  	return
   418  }
   419  
   420  // TryLaunchSharedManagedGuestSession calls the function "WEBEXT.login.launchSharedManagedGuestSession"
   421  // in a try/catch block and returns (_, err, ok = false) when it went through
   422  // the catch clause.
   423  func TryLaunchSharedManagedGuestSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   424  	ok = js.True == bindings.TryLaunchSharedManagedGuestSession(
   425  		js.Pointer(&ret), js.Pointer(&exception),
   426  		password.Ref(),
   427  	)
   428  
   429  	return
   430  }
   431  
   432  // HasFuncLockCurrentSession returns true if the function "WEBEXT.login.lockCurrentSession" exists.
   433  func HasFuncLockCurrentSession() bool {
   434  	return js.True == bindings.HasFuncLockCurrentSession()
   435  }
   436  
   437  // FuncLockCurrentSession returns the function "WEBEXT.login.lockCurrentSession".
   438  func FuncLockCurrentSession() (fn js.Func[func() js.Promise[js.Void]]) {
   439  	bindings.FuncLockCurrentSession(
   440  		js.Pointer(&fn),
   441  	)
   442  	return
   443  }
   444  
   445  // LockCurrentSession calls the function "WEBEXT.login.lockCurrentSession" directly.
   446  func LockCurrentSession() (ret js.Promise[js.Void]) {
   447  	bindings.CallLockCurrentSession(
   448  		js.Pointer(&ret),
   449  	)
   450  
   451  	return
   452  }
   453  
   454  // TryLockCurrentSession calls the function "WEBEXT.login.lockCurrentSession"
   455  // in a try/catch block and returns (_, err, ok = false) when it went through
   456  // the catch clause.
   457  func TryLockCurrentSession() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   458  	ok = js.True == bindings.TryLockCurrentSession(
   459  		js.Pointer(&ret), js.Pointer(&exception),
   460  	)
   461  
   462  	return
   463  }
   464  
   465  // HasFuncLockManagedGuestSession returns true if the function "WEBEXT.login.lockManagedGuestSession" exists.
   466  func HasFuncLockManagedGuestSession() bool {
   467  	return js.True == bindings.HasFuncLockManagedGuestSession()
   468  }
   469  
   470  // FuncLockManagedGuestSession returns the function "WEBEXT.login.lockManagedGuestSession".
   471  func FuncLockManagedGuestSession() (fn js.Func[func() js.Promise[js.Void]]) {
   472  	bindings.FuncLockManagedGuestSession(
   473  		js.Pointer(&fn),
   474  	)
   475  	return
   476  }
   477  
   478  // LockManagedGuestSession calls the function "WEBEXT.login.lockManagedGuestSession" directly.
   479  func LockManagedGuestSession() (ret js.Promise[js.Void]) {
   480  	bindings.CallLockManagedGuestSession(
   481  		js.Pointer(&ret),
   482  	)
   483  
   484  	return
   485  }
   486  
   487  // TryLockManagedGuestSession calls the function "WEBEXT.login.lockManagedGuestSession"
   488  // in a try/catch block and returns (_, err, ok = false) when it went through
   489  // the catch clause.
   490  func TryLockManagedGuestSession() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   491  	ok = js.True == bindings.TryLockManagedGuestSession(
   492  		js.Pointer(&ret), js.Pointer(&exception),
   493  	)
   494  
   495  	return
   496  }
   497  
   498  // HasFuncNotifyExternalLogoutDone returns true if the function "WEBEXT.login.notifyExternalLogoutDone" exists.
   499  func HasFuncNotifyExternalLogoutDone() bool {
   500  	return js.True == bindings.HasFuncNotifyExternalLogoutDone()
   501  }
   502  
   503  // FuncNotifyExternalLogoutDone returns the function "WEBEXT.login.notifyExternalLogoutDone".
   504  func FuncNotifyExternalLogoutDone() (fn js.Func[func() js.Promise[js.Void]]) {
   505  	bindings.FuncNotifyExternalLogoutDone(
   506  		js.Pointer(&fn),
   507  	)
   508  	return
   509  }
   510  
   511  // NotifyExternalLogoutDone calls the function "WEBEXT.login.notifyExternalLogoutDone" directly.
   512  func NotifyExternalLogoutDone() (ret js.Promise[js.Void]) {
   513  	bindings.CallNotifyExternalLogoutDone(
   514  		js.Pointer(&ret),
   515  	)
   516  
   517  	return
   518  }
   519  
   520  // TryNotifyExternalLogoutDone calls the function "WEBEXT.login.notifyExternalLogoutDone"
   521  // in a try/catch block and returns (_, err, ok = false) when it went through
   522  // the catch clause.
   523  func TryNotifyExternalLogoutDone() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   524  	ok = js.True == bindings.TryNotifyExternalLogoutDone(
   525  		js.Pointer(&ret), js.Pointer(&exception),
   526  	)
   527  
   528  	return
   529  }
   530  
   531  type OnExternalLogoutDoneEventCallbackFunc func(this js.Ref) js.Ref
   532  
   533  func (fn OnExternalLogoutDoneEventCallbackFunc) Register() js.Func[func()] {
   534  	return js.RegisterCallback[func()](
   535  		fn, abi.FuncPCABIInternal(fn),
   536  	)
   537  }
   538  
   539  func (fn OnExternalLogoutDoneEventCallbackFunc) DispatchCallback(
   540  	targetPC uintptr, ctx *js.CallbackContext,
   541  ) {
   542  	args := ctx.Args()
   543  	if len(args) != 0+1 /* js this */ ||
   544  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   545  		js.ThrowInvalidCallbackInvocation()
   546  	}
   547  
   548  	if ctx.Return(fn(
   549  		args[0],
   550  	)) {
   551  		return
   552  	}
   553  
   554  	js.ThrowCallbackValueNotReturned()
   555  }
   556  
   557  type OnExternalLogoutDoneEventCallback[T any] struct {
   558  	Fn  func(arg T, this js.Ref) js.Ref
   559  	Arg T
   560  }
   561  
   562  func (cb *OnExternalLogoutDoneEventCallback[T]) Register() js.Func[func()] {
   563  	return js.RegisterCallback[func()](
   564  		cb, abi.FuncPCABIInternal(cb.Fn),
   565  	)
   566  }
   567  
   568  func (cb *OnExternalLogoutDoneEventCallback[T]) DispatchCallback(
   569  	targetPC uintptr, ctx *js.CallbackContext,
   570  ) {
   571  	args := ctx.Args()
   572  	if len(args) != 0+1 /* js this */ ||
   573  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   574  		js.ThrowInvalidCallbackInvocation()
   575  	}
   576  
   577  	if ctx.Return(cb.Fn(
   578  		cb.Arg,
   579  		args[0],
   580  	)) {
   581  		return
   582  	}
   583  
   584  	js.ThrowCallbackValueNotReturned()
   585  }
   586  
   587  // HasFuncOnExternalLogoutDone returns true if the function "WEBEXT.login.onExternalLogoutDone.addListener" exists.
   588  func HasFuncOnExternalLogoutDone() bool {
   589  	return js.True == bindings.HasFuncOnExternalLogoutDone()
   590  }
   591  
   592  // FuncOnExternalLogoutDone returns the function "WEBEXT.login.onExternalLogoutDone.addListener".
   593  func FuncOnExternalLogoutDone() (fn js.Func[func(callback js.Func[func()])]) {
   594  	bindings.FuncOnExternalLogoutDone(
   595  		js.Pointer(&fn),
   596  	)
   597  	return
   598  }
   599  
   600  // OnExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.addListener" directly.
   601  func OnExternalLogoutDone(callback js.Func[func()]) (ret js.Void) {
   602  	bindings.CallOnExternalLogoutDone(
   603  		js.Pointer(&ret),
   604  		callback.Ref(),
   605  	)
   606  
   607  	return
   608  }
   609  
   610  // TryOnExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.addListener"
   611  // in a try/catch block and returns (_, err, ok = false) when it went through
   612  // the catch clause.
   613  func TryOnExternalLogoutDone(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
   614  	ok = js.True == bindings.TryOnExternalLogoutDone(
   615  		js.Pointer(&ret), js.Pointer(&exception),
   616  		callback.Ref(),
   617  	)
   618  
   619  	return
   620  }
   621  
   622  // HasFuncOffExternalLogoutDone returns true if the function "WEBEXT.login.onExternalLogoutDone.removeListener" exists.
   623  func HasFuncOffExternalLogoutDone() bool {
   624  	return js.True == bindings.HasFuncOffExternalLogoutDone()
   625  }
   626  
   627  // FuncOffExternalLogoutDone returns the function "WEBEXT.login.onExternalLogoutDone.removeListener".
   628  func FuncOffExternalLogoutDone() (fn js.Func[func(callback js.Func[func()])]) {
   629  	bindings.FuncOffExternalLogoutDone(
   630  		js.Pointer(&fn),
   631  	)
   632  	return
   633  }
   634  
   635  // OffExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.removeListener" directly.
   636  func OffExternalLogoutDone(callback js.Func[func()]) (ret js.Void) {
   637  	bindings.CallOffExternalLogoutDone(
   638  		js.Pointer(&ret),
   639  		callback.Ref(),
   640  	)
   641  
   642  	return
   643  }
   644  
   645  // TryOffExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.removeListener"
   646  // in a try/catch block and returns (_, err, ok = false) when it went through
   647  // the catch clause.
   648  func TryOffExternalLogoutDone(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
   649  	ok = js.True == bindings.TryOffExternalLogoutDone(
   650  		js.Pointer(&ret), js.Pointer(&exception),
   651  		callback.Ref(),
   652  	)
   653  
   654  	return
   655  }
   656  
   657  // HasFuncHasOnExternalLogoutDone returns true if the function "WEBEXT.login.onExternalLogoutDone.hasListener" exists.
   658  func HasFuncHasOnExternalLogoutDone() bool {
   659  	return js.True == bindings.HasFuncHasOnExternalLogoutDone()
   660  }
   661  
   662  // FuncHasOnExternalLogoutDone returns the function "WEBEXT.login.onExternalLogoutDone.hasListener".
   663  func FuncHasOnExternalLogoutDone() (fn js.Func[func(callback js.Func[func()]) bool]) {
   664  	bindings.FuncHasOnExternalLogoutDone(
   665  		js.Pointer(&fn),
   666  	)
   667  	return
   668  }
   669  
   670  // HasOnExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.hasListener" directly.
   671  func HasOnExternalLogoutDone(callback js.Func[func()]) (ret bool) {
   672  	bindings.CallHasOnExternalLogoutDone(
   673  		js.Pointer(&ret),
   674  		callback.Ref(),
   675  	)
   676  
   677  	return
   678  }
   679  
   680  // TryHasOnExternalLogoutDone calls the function "WEBEXT.login.onExternalLogoutDone.hasListener"
   681  // in a try/catch block and returns (_, err, ok = false) when it went through
   682  // the catch clause.
   683  func TryHasOnExternalLogoutDone(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) {
   684  	ok = js.True == bindings.TryHasOnExternalLogoutDone(
   685  		js.Pointer(&ret), js.Pointer(&exception),
   686  		callback.Ref(),
   687  	)
   688  
   689  	return
   690  }
   691  
   692  type OnRequestExternalLogoutEventCallbackFunc func(this js.Ref) js.Ref
   693  
   694  func (fn OnRequestExternalLogoutEventCallbackFunc) Register() js.Func[func()] {
   695  	return js.RegisterCallback[func()](
   696  		fn, abi.FuncPCABIInternal(fn),
   697  	)
   698  }
   699  
   700  func (fn OnRequestExternalLogoutEventCallbackFunc) DispatchCallback(
   701  	targetPC uintptr, ctx *js.CallbackContext,
   702  ) {
   703  	args := ctx.Args()
   704  	if len(args) != 0+1 /* js this */ ||
   705  		targetPC != uintptr(abi.FuncPCABIInternal(fn)) {
   706  		js.ThrowInvalidCallbackInvocation()
   707  	}
   708  
   709  	if ctx.Return(fn(
   710  		args[0],
   711  	)) {
   712  		return
   713  	}
   714  
   715  	js.ThrowCallbackValueNotReturned()
   716  }
   717  
   718  type OnRequestExternalLogoutEventCallback[T any] struct {
   719  	Fn  func(arg T, this js.Ref) js.Ref
   720  	Arg T
   721  }
   722  
   723  func (cb *OnRequestExternalLogoutEventCallback[T]) Register() js.Func[func()] {
   724  	return js.RegisterCallback[func()](
   725  		cb, abi.FuncPCABIInternal(cb.Fn),
   726  	)
   727  }
   728  
   729  func (cb *OnRequestExternalLogoutEventCallback[T]) DispatchCallback(
   730  	targetPC uintptr, ctx *js.CallbackContext,
   731  ) {
   732  	args := ctx.Args()
   733  	if len(args) != 0+1 /* js this */ ||
   734  		targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) {
   735  		js.ThrowInvalidCallbackInvocation()
   736  	}
   737  
   738  	if ctx.Return(cb.Fn(
   739  		cb.Arg,
   740  		args[0],
   741  	)) {
   742  		return
   743  	}
   744  
   745  	js.ThrowCallbackValueNotReturned()
   746  }
   747  
   748  // HasFuncOnRequestExternalLogout returns true if the function "WEBEXT.login.onRequestExternalLogout.addListener" exists.
   749  func HasFuncOnRequestExternalLogout() bool {
   750  	return js.True == bindings.HasFuncOnRequestExternalLogout()
   751  }
   752  
   753  // FuncOnRequestExternalLogout returns the function "WEBEXT.login.onRequestExternalLogout.addListener".
   754  func FuncOnRequestExternalLogout() (fn js.Func[func(callback js.Func[func()])]) {
   755  	bindings.FuncOnRequestExternalLogout(
   756  		js.Pointer(&fn),
   757  	)
   758  	return
   759  }
   760  
   761  // OnRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.addListener" directly.
   762  func OnRequestExternalLogout(callback js.Func[func()]) (ret js.Void) {
   763  	bindings.CallOnRequestExternalLogout(
   764  		js.Pointer(&ret),
   765  		callback.Ref(),
   766  	)
   767  
   768  	return
   769  }
   770  
   771  // TryOnRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.addListener"
   772  // in a try/catch block and returns (_, err, ok = false) when it went through
   773  // the catch clause.
   774  func TryOnRequestExternalLogout(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
   775  	ok = js.True == bindings.TryOnRequestExternalLogout(
   776  		js.Pointer(&ret), js.Pointer(&exception),
   777  		callback.Ref(),
   778  	)
   779  
   780  	return
   781  }
   782  
   783  // HasFuncOffRequestExternalLogout returns true if the function "WEBEXT.login.onRequestExternalLogout.removeListener" exists.
   784  func HasFuncOffRequestExternalLogout() bool {
   785  	return js.True == bindings.HasFuncOffRequestExternalLogout()
   786  }
   787  
   788  // FuncOffRequestExternalLogout returns the function "WEBEXT.login.onRequestExternalLogout.removeListener".
   789  func FuncOffRequestExternalLogout() (fn js.Func[func(callback js.Func[func()])]) {
   790  	bindings.FuncOffRequestExternalLogout(
   791  		js.Pointer(&fn),
   792  	)
   793  	return
   794  }
   795  
   796  // OffRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.removeListener" directly.
   797  func OffRequestExternalLogout(callback js.Func[func()]) (ret js.Void) {
   798  	bindings.CallOffRequestExternalLogout(
   799  		js.Pointer(&ret),
   800  		callback.Ref(),
   801  	)
   802  
   803  	return
   804  }
   805  
   806  // TryOffRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.removeListener"
   807  // in a try/catch block and returns (_, err, ok = false) when it went through
   808  // the catch clause.
   809  func TryOffRequestExternalLogout(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) {
   810  	ok = js.True == bindings.TryOffRequestExternalLogout(
   811  		js.Pointer(&ret), js.Pointer(&exception),
   812  		callback.Ref(),
   813  	)
   814  
   815  	return
   816  }
   817  
   818  // HasFuncHasOnRequestExternalLogout returns true if the function "WEBEXT.login.onRequestExternalLogout.hasListener" exists.
   819  func HasFuncHasOnRequestExternalLogout() bool {
   820  	return js.True == bindings.HasFuncHasOnRequestExternalLogout()
   821  }
   822  
   823  // FuncHasOnRequestExternalLogout returns the function "WEBEXT.login.onRequestExternalLogout.hasListener".
   824  func FuncHasOnRequestExternalLogout() (fn js.Func[func(callback js.Func[func()]) bool]) {
   825  	bindings.FuncHasOnRequestExternalLogout(
   826  		js.Pointer(&fn),
   827  	)
   828  	return
   829  }
   830  
   831  // HasOnRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.hasListener" directly.
   832  func HasOnRequestExternalLogout(callback js.Func[func()]) (ret bool) {
   833  	bindings.CallHasOnRequestExternalLogout(
   834  		js.Pointer(&ret),
   835  		callback.Ref(),
   836  	)
   837  
   838  	return
   839  }
   840  
   841  // TryHasOnRequestExternalLogout calls the function "WEBEXT.login.onRequestExternalLogout.hasListener"
   842  // in a try/catch block and returns (_, err, ok = false) when it went through
   843  // the catch clause.
   844  func TryHasOnRequestExternalLogout(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) {
   845  	ok = js.True == bindings.TryHasOnRequestExternalLogout(
   846  		js.Pointer(&ret), js.Pointer(&exception),
   847  		callback.Ref(),
   848  	)
   849  
   850  	return
   851  }
   852  
   853  // HasFuncRequestExternalLogout returns true if the function "WEBEXT.login.requestExternalLogout" exists.
   854  func HasFuncRequestExternalLogout() bool {
   855  	return js.True == bindings.HasFuncRequestExternalLogout()
   856  }
   857  
   858  // FuncRequestExternalLogout returns the function "WEBEXT.login.requestExternalLogout".
   859  func FuncRequestExternalLogout() (fn js.Func[func() js.Promise[js.Void]]) {
   860  	bindings.FuncRequestExternalLogout(
   861  		js.Pointer(&fn),
   862  	)
   863  	return
   864  }
   865  
   866  // RequestExternalLogout calls the function "WEBEXT.login.requestExternalLogout" directly.
   867  func RequestExternalLogout() (ret js.Promise[js.Void]) {
   868  	bindings.CallRequestExternalLogout(
   869  		js.Pointer(&ret),
   870  	)
   871  
   872  	return
   873  }
   874  
   875  // TryRequestExternalLogout calls the function "WEBEXT.login.requestExternalLogout"
   876  // in a try/catch block and returns (_, err, ok = false) when it went through
   877  // the catch clause.
   878  func TryRequestExternalLogout() (ret js.Promise[js.Void], exception js.Any, ok bool) {
   879  	ok = js.True == bindings.TryRequestExternalLogout(
   880  		js.Pointer(&ret), js.Pointer(&exception),
   881  	)
   882  
   883  	return
   884  }
   885  
   886  // HasFuncSetDataForNextLoginAttempt returns true if the function "WEBEXT.login.setDataForNextLoginAttempt" exists.
   887  func HasFuncSetDataForNextLoginAttempt() bool {
   888  	return js.True == bindings.HasFuncSetDataForNextLoginAttempt()
   889  }
   890  
   891  // FuncSetDataForNextLoginAttempt returns the function "WEBEXT.login.setDataForNextLoginAttempt".
   892  func FuncSetDataForNextLoginAttempt() (fn js.Func[func(dataForNextLoginAttempt js.String) js.Promise[js.Void]]) {
   893  	bindings.FuncSetDataForNextLoginAttempt(
   894  		js.Pointer(&fn),
   895  	)
   896  	return
   897  }
   898  
   899  // SetDataForNextLoginAttempt calls the function "WEBEXT.login.setDataForNextLoginAttempt" directly.
   900  func SetDataForNextLoginAttempt(dataForNextLoginAttempt js.String) (ret js.Promise[js.Void]) {
   901  	bindings.CallSetDataForNextLoginAttempt(
   902  		js.Pointer(&ret),
   903  		dataForNextLoginAttempt.Ref(),
   904  	)
   905  
   906  	return
   907  }
   908  
   909  // TrySetDataForNextLoginAttempt calls the function "WEBEXT.login.setDataForNextLoginAttempt"
   910  // in a try/catch block and returns (_, err, ok = false) when it went through
   911  // the catch clause.
   912  func TrySetDataForNextLoginAttempt(dataForNextLoginAttempt js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   913  	ok = js.True == bindings.TrySetDataForNextLoginAttempt(
   914  		js.Pointer(&ret), js.Pointer(&exception),
   915  		dataForNextLoginAttempt.Ref(),
   916  	)
   917  
   918  	return
   919  }
   920  
   921  // HasFuncUnlockCurrentSession returns true if the function "WEBEXT.login.unlockCurrentSession" exists.
   922  func HasFuncUnlockCurrentSession() bool {
   923  	return js.True == bindings.HasFuncUnlockCurrentSession()
   924  }
   925  
   926  // FuncUnlockCurrentSession returns the function "WEBEXT.login.unlockCurrentSession".
   927  func FuncUnlockCurrentSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   928  	bindings.FuncUnlockCurrentSession(
   929  		js.Pointer(&fn),
   930  	)
   931  	return
   932  }
   933  
   934  // UnlockCurrentSession calls the function "WEBEXT.login.unlockCurrentSession" directly.
   935  func UnlockCurrentSession(password js.String) (ret js.Promise[js.Void]) {
   936  	bindings.CallUnlockCurrentSession(
   937  		js.Pointer(&ret),
   938  		password.Ref(),
   939  	)
   940  
   941  	return
   942  }
   943  
   944  // TryUnlockCurrentSession calls the function "WEBEXT.login.unlockCurrentSession"
   945  // in a try/catch block and returns (_, err, ok = false) when it went through
   946  // the catch clause.
   947  func TryUnlockCurrentSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   948  	ok = js.True == bindings.TryUnlockCurrentSession(
   949  		js.Pointer(&ret), js.Pointer(&exception),
   950  		password.Ref(),
   951  	)
   952  
   953  	return
   954  }
   955  
   956  // HasFuncUnlockManagedGuestSession returns true if the function "WEBEXT.login.unlockManagedGuestSession" exists.
   957  func HasFuncUnlockManagedGuestSession() bool {
   958  	return js.True == bindings.HasFuncUnlockManagedGuestSession()
   959  }
   960  
   961  // FuncUnlockManagedGuestSession returns the function "WEBEXT.login.unlockManagedGuestSession".
   962  func FuncUnlockManagedGuestSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   963  	bindings.FuncUnlockManagedGuestSession(
   964  		js.Pointer(&fn),
   965  	)
   966  	return
   967  }
   968  
   969  // UnlockManagedGuestSession calls the function "WEBEXT.login.unlockManagedGuestSession" directly.
   970  func UnlockManagedGuestSession(password js.String) (ret js.Promise[js.Void]) {
   971  	bindings.CallUnlockManagedGuestSession(
   972  		js.Pointer(&ret),
   973  		password.Ref(),
   974  	)
   975  
   976  	return
   977  }
   978  
   979  // TryUnlockManagedGuestSession calls the function "WEBEXT.login.unlockManagedGuestSession"
   980  // in a try/catch block and returns (_, err, ok = false) when it went through
   981  // the catch clause.
   982  func TryUnlockManagedGuestSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
   983  	ok = js.True == bindings.TryUnlockManagedGuestSession(
   984  		js.Pointer(&ret), js.Pointer(&exception),
   985  		password.Ref(),
   986  	)
   987  
   988  	return
   989  }
   990  
   991  // HasFuncUnlockSharedSession returns true if the function "WEBEXT.login.unlockSharedSession" exists.
   992  func HasFuncUnlockSharedSession() bool {
   993  	return js.True == bindings.HasFuncUnlockSharedSession()
   994  }
   995  
   996  // FuncUnlockSharedSession returns the function "WEBEXT.login.unlockSharedSession".
   997  func FuncUnlockSharedSession() (fn js.Func[func(password js.String) js.Promise[js.Void]]) {
   998  	bindings.FuncUnlockSharedSession(
   999  		js.Pointer(&fn),
  1000  	)
  1001  	return
  1002  }
  1003  
  1004  // UnlockSharedSession calls the function "WEBEXT.login.unlockSharedSession" directly.
  1005  func UnlockSharedSession(password js.String) (ret js.Promise[js.Void]) {
  1006  	bindings.CallUnlockSharedSession(
  1007  		js.Pointer(&ret),
  1008  		password.Ref(),
  1009  	)
  1010  
  1011  	return
  1012  }
  1013  
  1014  // TryUnlockSharedSession calls the function "WEBEXT.login.unlockSharedSession"
  1015  // in a try/catch block and returns (_, err, ok = false) when it went through
  1016  // the catch clause.
  1017  func TryUnlockSharedSession(password js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) {
  1018  	ok = js.True == bindings.TryUnlockSharedSession(
  1019  		js.Pointer(&ret), js.Pointer(&exception),
  1020  		password.Ref(),
  1021  	)
  1022  
  1023  	return
  1024  }