github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/browseraction/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package browseraction 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/browseraction/bindings" 11 "github.com/primecitizens/pcz/std/plat/js/webext/tabs" 12 ) 13 14 type ColorArray = js.Array[int64] 15 16 type ImageDataType struct { 17 FFI_USE bool 18 } 19 20 // FromRef calls UpdateFrom and returns a ImageDataType with all fields set. 21 func (p ImageDataType) FromRef(ref js.Ref) ImageDataType { 22 p.UpdateFrom(ref) 23 return p 24 } 25 26 // New creates a new ImageDataType in the application heap. 27 func (p ImageDataType) New() js.Ref { 28 return bindings.ImageDataTypeJSLoad( 29 js.Pointer(&p), js.True, 0, 30 ) 31 } 32 33 // UpdateFrom copies value of all fields of the heap object to p. 34 func (p *ImageDataType) UpdateFrom(ref js.Ref) { 35 bindings.ImageDataTypeJSStore( 36 js.Pointer(p), ref, 37 ) 38 } 39 40 // Update writes all fields of the p to the heap object referenced by ref. 41 func (p *ImageDataType) Update(ref js.Ref) { 42 bindings.ImageDataTypeJSLoad( 43 js.Pointer(p), js.False, ref, 44 ) 45 } 46 47 // FreeMembers frees fields with heap reference, if recursive is true 48 // free all heap references reachable from p. 49 func (p *ImageDataType) FreeMembers(recursive bool) { 50 } 51 52 type OneOf_String_ArrayInt64 struct { 53 ref js.Ref 54 } 55 56 func (x OneOf_String_ArrayInt64) Ref() js.Ref { 57 return x.ref 58 } 59 60 func (x OneOf_String_ArrayInt64) Free() { 61 x.ref.Free() 62 } 63 64 func (x OneOf_String_ArrayInt64) FromRef(ref js.Ref) OneOf_String_ArrayInt64 { 65 return OneOf_String_ArrayInt64{ 66 ref: ref, 67 } 68 } 69 70 func (x OneOf_String_ArrayInt64) String() js.String { 71 return js.String{}.FromRef(x.ref) 72 } 73 74 func (x OneOf_String_ArrayInt64) ArrayInt64() js.Array[int64] { 75 return js.Array[int64]{}.FromRef(x.ref) 76 } 77 78 type SetBadgeBackgroundColorArgDetails struct { 79 // Color is "SetBadgeBackgroundColorArgDetails.color" 80 // 81 // Required 82 Color OneOf_String_ArrayInt64 83 // TabId is "SetBadgeBackgroundColorArgDetails.tabId" 84 // 85 // Optional 86 // 87 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 88 TabId int64 89 90 FFI_USE_TabId bool // for TabId. 91 92 FFI_USE bool 93 } 94 95 // FromRef calls UpdateFrom and returns a SetBadgeBackgroundColorArgDetails with all fields set. 96 func (p SetBadgeBackgroundColorArgDetails) FromRef(ref js.Ref) SetBadgeBackgroundColorArgDetails { 97 p.UpdateFrom(ref) 98 return p 99 } 100 101 // New creates a new SetBadgeBackgroundColorArgDetails in the application heap. 102 func (p SetBadgeBackgroundColorArgDetails) New() js.Ref { 103 return bindings.SetBadgeBackgroundColorArgDetailsJSLoad( 104 js.Pointer(&p), js.True, 0, 105 ) 106 } 107 108 // UpdateFrom copies value of all fields of the heap object to p. 109 func (p *SetBadgeBackgroundColorArgDetails) UpdateFrom(ref js.Ref) { 110 bindings.SetBadgeBackgroundColorArgDetailsJSStore( 111 js.Pointer(p), ref, 112 ) 113 } 114 115 // Update writes all fields of the p to the heap object referenced by ref. 116 func (p *SetBadgeBackgroundColorArgDetails) Update(ref js.Ref) { 117 bindings.SetBadgeBackgroundColorArgDetailsJSLoad( 118 js.Pointer(p), js.False, ref, 119 ) 120 } 121 122 // FreeMembers frees fields with heap reference, if recursive is true 123 // free all heap references reachable from p. 124 func (p *SetBadgeBackgroundColorArgDetails) FreeMembers(recursive bool) { 125 js.Free( 126 p.Color.Ref(), 127 ) 128 p.Color = p.Color.FromRef(js.Undefined) 129 } 130 131 type SetBadgeTextArgDetails struct { 132 // TabId is "SetBadgeTextArgDetails.tabId" 133 // 134 // Optional 135 // 136 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 137 TabId int64 138 // Text is "SetBadgeTextArgDetails.text" 139 // 140 // Optional 141 Text js.String 142 143 FFI_USE_TabId bool // for TabId. 144 145 FFI_USE bool 146 } 147 148 // FromRef calls UpdateFrom and returns a SetBadgeTextArgDetails with all fields set. 149 func (p SetBadgeTextArgDetails) FromRef(ref js.Ref) SetBadgeTextArgDetails { 150 p.UpdateFrom(ref) 151 return p 152 } 153 154 // New creates a new SetBadgeTextArgDetails in the application heap. 155 func (p SetBadgeTextArgDetails) New() js.Ref { 156 return bindings.SetBadgeTextArgDetailsJSLoad( 157 js.Pointer(&p), js.True, 0, 158 ) 159 } 160 161 // UpdateFrom copies value of all fields of the heap object to p. 162 func (p *SetBadgeTextArgDetails) UpdateFrom(ref js.Ref) { 163 bindings.SetBadgeTextArgDetailsJSStore( 164 js.Pointer(p), ref, 165 ) 166 } 167 168 // Update writes all fields of the p to the heap object referenced by ref. 169 func (p *SetBadgeTextArgDetails) Update(ref js.Ref) { 170 bindings.SetBadgeTextArgDetailsJSLoad( 171 js.Pointer(p), js.False, ref, 172 ) 173 } 174 175 // FreeMembers frees fields with heap reference, if recursive is true 176 // free all heap references reachable from p. 177 func (p *SetBadgeTextArgDetails) FreeMembers(recursive bool) { 178 js.Free( 179 p.Text.Ref(), 180 ) 181 p.Text = p.Text.FromRef(js.Undefined) 182 } 183 184 type OneOf_ImageDataType_Any struct { 185 ref js.Ref 186 } 187 188 func (x OneOf_ImageDataType_Any) Ref() js.Ref { 189 return x.ref 190 } 191 192 func (x OneOf_ImageDataType_Any) Free() { 193 x.ref.Free() 194 } 195 196 func (x OneOf_ImageDataType_Any) FromRef(ref js.Ref) OneOf_ImageDataType_Any { 197 return OneOf_ImageDataType_Any{ 198 ref: ref, 199 } 200 } 201 202 func (x OneOf_ImageDataType_Any) ImageDataType() ImageDataType { 203 var ret ImageDataType 204 ret.UpdateFrom(x.ref) 205 return ret 206 } 207 208 func (x OneOf_ImageDataType_Any) Any() js.Any { 209 return js.Any{}.FromRef(x.ref) 210 } 211 212 type OneOf_String_Any struct { 213 ref js.Ref 214 } 215 216 func (x OneOf_String_Any) Ref() js.Ref { 217 return x.ref 218 } 219 220 func (x OneOf_String_Any) Free() { 221 x.ref.Free() 222 } 223 224 func (x OneOf_String_Any) FromRef(ref js.Ref) OneOf_String_Any { 225 return OneOf_String_Any{ 226 ref: ref, 227 } 228 } 229 230 func (x OneOf_String_Any) String() js.String { 231 return js.String{}.FromRef(x.ref) 232 } 233 234 func (x OneOf_String_Any) Any() js.Any { 235 return js.Any{}.FromRef(x.ref) 236 } 237 238 type SetIconArgDetails struct { 239 // ImageData is "SetIconArgDetails.imageData" 240 // 241 // Optional 242 ImageData OneOf_ImageDataType_Any 243 // Path is "SetIconArgDetails.path" 244 // 245 // Optional 246 Path OneOf_String_Any 247 // TabId is "SetIconArgDetails.tabId" 248 // 249 // Optional 250 // 251 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 252 TabId int64 253 254 FFI_USE_TabId bool // for TabId. 255 256 FFI_USE bool 257 } 258 259 // FromRef calls UpdateFrom and returns a SetIconArgDetails with all fields set. 260 func (p SetIconArgDetails) FromRef(ref js.Ref) SetIconArgDetails { 261 p.UpdateFrom(ref) 262 return p 263 } 264 265 // New creates a new SetIconArgDetails in the application heap. 266 func (p SetIconArgDetails) New() js.Ref { 267 return bindings.SetIconArgDetailsJSLoad( 268 js.Pointer(&p), js.True, 0, 269 ) 270 } 271 272 // UpdateFrom copies value of all fields of the heap object to p. 273 func (p *SetIconArgDetails) UpdateFrom(ref js.Ref) { 274 bindings.SetIconArgDetailsJSStore( 275 js.Pointer(p), ref, 276 ) 277 } 278 279 // Update writes all fields of the p to the heap object referenced by ref. 280 func (p *SetIconArgDetails) Update(ref js.Ref) { 281 bindings.SetIconArgDetailsJSLoad( 282 js.Pointer(p), js.False, ref, 283 ) 284 } 285 286 // FreeMembers frees fields with heap reference, if recursive is true 287 // free all heap references reachable from p. 288 func (p *SetIconArgDetails) FreeMembers(recursive bool) { 289 js.Free( 290 p.ImageData.Ref(), 291 p.Path.Ref(), 292 ) 293 p.ImageData = p.ImageData.FromRef(js.Undefined) 294 p.Path = p.Path.FromRef(js.Undefined) 295 } 296 297 type SetPopupArgDetails struct { 298 // Popup is "SetPopupArgDetails.popup" 299 // 300 // Required 301 Popup js.String 302 // TabId is "SetPopupArgDetails.tabId" 303 // 304 // Optional 305 // 306 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 307 TabId int64 308 309 FFI_USE_TabId bool // for TabId. 310 311 FFI_USE bool 312 } 313 314 // FromRef calls UpdateFrom and returns a SetPopupArgDetails with all fields set. 315 func (p SetPopupArgDetails) FromRef(ref js.Ref) SetPopupArgDetails { 316 p.UpdateFrom(ref) 317 return p 318 } 319 320 // New creates a new SetPopupArgDetails in the application heap. 321 func (p SetPopupArgDetails) New() js.Ref { 322 return bindings.SetPopupArgDetailsJSLoad( 323 js.Pointer(&p), js.True, 0, 324 ) 325 } 326 327 // UpdateFrom copies value of all fields of the heap object to p. 328 func (p *SetPopupArgDetails) UpdateFrom(ref js.Ref) { 329 bindings.SetPopupArgDetailsJSStore( 330 js.Pointer(p), ref, 331 ) 332 } 333 334 // Update writes all fields of the p to the heap object referenced by ref. 335 func (p *SetPopupArgDetails) Update(ref js.Ref) { 336 bindings.SetPopupArgDetailsJSLoad( 337 js.Pointer(p), js.False, ref, 338 ) 339 } 340 341 // FreeMembers frees fields with heap reference, if recursive is true 342 // free all heap references reachable from p. 343 func (p *SetPopupArgDetails) FreeMembers(recursive bool) { 344 js.Free( 345 p.Popup.Ref(), 346 ) 347 p.Popup = p.Popup.FromRef(js.Undefined) 348 } 349 350 type SetTitleArgDetails struct { 351 // TabId is "SetTitleArgDetails.tabId" 352 // 353 // Optional 354 // 355 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 356 TabId int64 357 // Title is "SetTitleArgDetails.title" 358 // 359 // Required 360 Title js.String 361 362 FFI_USE_TabId bool // for TabId. 363 364 FFI_USE bool 365 } 366 367 // FromRef calls UpdateFrom and returns a SetTitleArgDetails with all fields set. 368 func (p SetTitleArgDetails) FromRef(ref js.Ref) SetTitleArgDetails { 369 p.UpdateFrom(ref) 370 return p 371 } 372 373 // New creates a new SetTitleArgDetails in the application heap. 374 func (p SetTitleArgDetails) New() js.Ref { 375 return bindings.SetTitleArgDetailsJSLoad( 376 js.Pointer(&p), js.True, 0, 377 ) 378 } 379 380 // UpdateFrom copies value of all fields of the heap object to p. 381 func (p *SetTitleArgDetails) UpdateFrom(ref js.Ref) { 382 bindings.SetTitleArgDetailsJSStore( 383 js.Pointer(p), ref, 384 ) 385 } 386 387 // Update writes all fields of the p to the heap object referenced by ref. 388 func (p *SetTitleArgDetails) Update(ref js.Ref) { 389 bindings.SetTitleArgDetailsJSLoad( 390 js.Pointer(p), js.False, ref, 391 ) 392 } 393 394 // FreeMembers frees fields with heap reference, if recursive is true 395 // free all heap references reachable from p. 396 func (p *SetTitleArgDetails) FreeMembers(recursive bool) { 397 js.Free( 398 p.Title.Ref(), 399 ) 400 p.Title = p.Title.FromRef(js.Undefined) 401 } 402 403 type TabDetails struct { 404 // TabId is "TabDetails.tabId" 405 // 406 // Optional 407 // 408 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 409 TabId int64 410 411 FFI_USE_TabId bool // for TabId. 412 413 FFI_USE bool 414 } 415 416 // FromRef calls UpdateFrom and returns a TabDetails with all fields set. 417 func (p TabDetails) FromRef(ref js.Ref) TabDetails { 418 p.UpdateFrom(ref) 419 return p 420 } 421 422 // New creates a new TabDetails in the application heap. 423 func (p TabDetails) New() js.Ref { 424 return bindings.TabDetailsJSLoad( 425 js.Pointer(&p), js.True, 0, 426 ) 427 } 428 429 // UpdateFrom copies value of all fields of the heap object to p. 430 func (p *TabDetails) UpdateFrom(ref js.Ref) { 431 bindings.TabDetailsJSStore( 432 js.Pointer(p), ref, 433 ) 434 } 435 436 // Update writes all fields of the p to the heap object referenced by ref. 437 func (p *TabDetails) Update(ref js.Ref) { 438 bindings.TabDetailsJSLoad( 439 js.Pointer(p), js.False, ref, 440 ) 441 } 442 443 // FreeMembers frees fields with heap reference, if recursive is true 444 // free all heap references reachable from p. 445 func (p *TabDetails) FreeMembers(recursive bool) { 446 } 447 448 // HasFuncDisable returns true if the function "WEBEXT.browserAction.disable" exists. 449 func HasFuncDisable() bool { 450 return js.True == bindings.HasFuncDisable() 451 } 452 453 // FuncDisable returns the function "WEBEXT.browserAction.disable". 454 func FuncDisable() (fn js.Func[func(tabId int64) js.Promise[js.Void]]) { 455 bindings.FuncDisable( 456 js.Pointer(&fn), 457 ) 458 return 459 } 460 461 // Disable calls the function "WEBEXT.browserAction.disable" directly. 462 func Disable(tabId int64) (ret js.Promise[js.Void]) { 463 bindings.CallDisable( 464 js.Pointer(&ret), 465 float64(tabId), 466 ) 467 468 return 469 } 470 471 // TryDisable calls the function "WEBEXT.browserAction.disable" 472 // in a try/catch block and returns (_, err, ok = false) when it went through 473 // the catch clause. 474 func TryDisable(tabId int64) (ret js.Promise[js.Void], exception js.Any, ok bool) { 475 ok = js.True == bindings.TryDisable( 476 js.Pointer(&ret), js.Pointer(&exception), 477 float64(tabId), 478 ) 479 480 return 481 } 482 483 // HasFuncEnable returns true if the function "WEBEXT.browserAction.enable" exists. 484 func HasFuncEnable() bool { 485 return js.True == bindings.HasFuncEnable() 486 } 487 488 // FuncEnable returns the function "WEBEXT.browserAction.enable". 489 func FuncEnable() (fn js.Func[func(tabId int64) js.Promise[js.Void]]) { 490 bindings.FuncEnable( 491 js.Pointer(&fn), 492 ) 493 return 494 } 495 496 // Enable calls the function "WEBEXT.browserAction.enable" directly. 497 func Enable(tabId int64) (ret js.Promise[js.Void]) { 498 bindings.CallEnable( 499 js.Pointer(&ret), 500 float64(tabId), 501 ) 502 503 return 504 } 505 506 // TryEnable calls the function "WEBEXT.browserAction.enable" 507 // in a try/catch block and returns (_, err, ok = false) when it went through 508 // the catch clause. 509 func TryEnable(tabId int64) (ret js.Promise[js.Void], exception js.Any, ok bool) { 510 ok = js.True == bindings.TryEnable( 511 js.Pointer(&ret), js.Pointer(&exception), 512 float64(tabId), 513 ) 514 515 return 516 } 517 518 // HasFuncGetBadgeBackgroundColor returns true if the function "WEBEXT.browserAction.getBadgeBackgroundColor" exists. 519 func HasFuncGetBadgeBackgroundColor() bool { 520 return js.True == bindings.HasFuncGetBadgeBackgroundColor() 521 } 522 523 // FuncGetBadgeBackgroundColor returns the function "WEBEXT.browserAction.getBadgeBackgroundColor". 524 func FuncGetBadgeBackgroundColor() (fn js.Func[func(details TabDetails) js.Promise[ColorArray]]) { 525 bindings.FuncGetBadgeBackgroundColor( 526 js.Pointer(&fn), 527 ) 528 return 529 } 530 531 // GetBadgeBackgroundColor calls the function "WEBEXT.browserAction.getBadgeBackgroundColor" directly. 532 func GetBadgeBackgroundColor(details TabDetails) (ret js.Promise[ColorArray]) { 533 bindings.CallGetBadgeBackgroundColor( 534 js.Pointer(&ret), 535 js.Pointer(&details), 536 ) 537 538 return 539 } 540 541 // TryGetBadgeBackgroundColor calls the function "WEBEXT.browserAction.getBadgeBackgroundColor" 542 // in a try/catch block and returns (_, err, ok = false) when it went through 543 // the catch clause. 544 func TryGetBadgeBackgroundColor(details TabDetails) (ret js.Promise[ColorArray], exception js.Any, ok bool) { 545 ok = js.True == bindings.TryGetBadgeBackgroundColor( 546 js.Pointer(&ret), js.Pointer(&exception), 547 js.Pointer(&details), 548 ) 549 550 return 551 } 552 553 // HasFuncGetBadgeText returns true if the function "WEBEXT.browserAction.getBadgeText" exists. 554 func HasFuncGetBadgeText() bool { 555 return js.True == bindings.HasFuncGetBadgeText() 556 } 557 558 // FuncGetBadgeText returns the function "WEBEXT.browserAction.getBadgeText". 559 func FuncGetBadgeText() (fn js.Func[func(details TabDetails) js.Promise[js.String]]) { 560 bindings.FuncGetBadgeText( 561 js.Pointer(&fn), 562 ) 563 return 564 } 565 566 // GetBadgeText calls the function "WEBEXT.browserAction.getBadgeText" directly. 567 func GetBadgeText(details TabDetails) (ret js.Promise[js.String]) { 568 bindings.CallGetBadgeText( 569 js.Pointer(&ret), 570 js.Pointer(&details), 571 ) 572 573 return 574 } 575 576 // TryGetBadgeText calls the function "WEBEXT.browserAction.getBadgeText" 577 // in a try/catch block and returns (_, err, ok = false) when it went through 578 // the catch clause. 579 func TryGetBadgeText(details TabDetails) (ret js.Promise[js.String], exception js.Any, ok bool) { 580 ok = js.True == bindings.TryGetBadgeText( 581 js.Pointer(&ret), js.Pointer(&exception), 582 js.Pointer(&details), 583 ) 584 585 return 586 } 587 588 // HasFuncGetPopup returns true if the function "WEBEXT.browserAction.getPopup" exists. 589 func HasFuncGetPopup() bool { 590 return js.True == bindings.HasFuncGetPopup() 591 } 592 593 // FuncGetPopup returns the function "WEBEXT.browserAction.getPopup". 594 func FuncGetPopup() (fn js.Func[func(details TabDetails) js.Promise[js.String]]) { 595 bindings.FuncGetPopup( 596 js.Pointer(&fn), 597 ) 598 return 599 } 600 601 // GetPopup calls the function "WEBEXT.browserAction.getPopup" directly. 602 func GetPopup(details TabDetails) (ret js.Promise[js.String]) { 603 bindings.CallGetPopup( 604 js.Pointer(&ret), 605 js.Pointer(&details), 606 ) 607 608 return 609 } 610 611 // TryGetPopup calls the function "WEBEXT.browserAction.getPopup" 612 // in a try/catch block and returns (_, err, ok = false) when it went through 613 // the catch clause. 614 func TryGetPopup(details TabDetails) (ret js.Promise[js.String], exception js.Any, ok bool) { 615 ok = js.True == bindings.TryGetPopup( 616 js.Pointer(&ret), js.Pointer(&exception), 617 js.Pointer(&details), 618 ) 619 620 return 621 } 622 623 // HasFuncGetTitle returns true if the function "WEBEXT.browserAction.getTitle" exists. 624 func HasFuncGetTitle() bool { 625 return js.True == bindings.HasFuncGetTitle() 626 } 627 628 // FuncGetTitle returns the function "WEBEXT.browserAction.getTitle". 629 func FuncGetTitle() (fn js.Func[func(details TabDetails) js.Promise[js.String]]) { 630 bindings.FuncGetTitle( 631 js.Pointer(&fn), 632 ) 633 return 634 } 635 636 // GetTitle calls the function "WEBEXT.browserAction.getTitle" directly. 637 func GetTitle(details TabDetails) (ret js.Promise[js.String]) { 638 bindings.CallGetTitle( 639 js.Pointer(&ret), 640 js.Pointer(&details), 641 ) 642 643 return 644 } 645 646 // TryGetTitle calls the function "WEBEXT.browserAction.getTitle" 647 // in a try/catch block and returns (_, err, ok = false) when it went through 648 // the catch clause. 649 func TryGetTitle(details TabDetails) (ret js.Promise[js.String], exception js.Any, ok bool) { 650 ok = js.True == bindings.TryGetTitle( 651 js.Pointer(&ret), js.Pointer(&exception), 652 js.Pointer(&details), 653 ) 654 655 return 656 } 657 658 type OnClickedEventCallbackFunc func(this js.Ref, tab *tabs.Tab) js.Ref 659 660 func (fn OnClickedEventCallbackFunc) Register() js.Func[func(tab *tabs.Tab)] { 661 return js.RegisterCallback[func(tab *tabs.Tab)]( 662 fn, abi.FuncPCABIInternal(fn), 663 ) 664 } 665 666 func (fn OnClickedEventCallbackFunc) DispatchCallback( 667 targetPC uintptr, ctx *js.CallbackContext, 668 ) { 669 args := ctx.Args() 670 if len(args) != 1+1 /* js this */ || 671 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 672 js.ThrowInvalidCallbackInvocation() 673 } 674 var arg0 tabs.Tab 675 arg0.UpdateFrom(args[0+1]) 676 defer arg0.FreeMembers(true) 677 678 if ctx.Return(fn( 679 args[0], 680 681 mark.NoEscape(&arg0), 682 )) { 683 return 684 } 685 686 js.ThrowCallbackValueNotReturned() 687 } 688 689 type OnClickedEventCallback[T any] struct { 690 Fn func(arg T, this js.Ref, tab *tabs.Tab) js.Ref 691 Arg T 692 } 693 694 func (cb *OnClickedEventCallback[T]) Register() js.Func[func(tab *tabs.Tab)] { 695 return js.RegisterCallback[func(tab *tabs.Tab)]( 696 cb, abi.FuncPCABIInternal(cb.Fn), 697 ) 698 } 699 700 func (cb *OnClickedEventCallback[T]) DispatchCallback( 701 targetPC uintptr, ctx *js.CallbackContext, 702 ) { 703 args := ctx.Args() 704 if len(args) != 1+1 /* js this */ || 705 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 706 js.ThrowInvalidCallbackInvocation() 707 } 708 var arg0 tabs.Tab 709 arg0.UpdateFrom(args[0+1]) 710 defer arg0.FreeMembers(true) 711 712 if ctx.Return(cb.Fn( 713 cb.Arg, 714 args[0], 715 716 mark.NoEscape(&arg0), 717 )) { 718 return 719 } 720 721 js.ThrowCallbackValueNotReturned() 722 } 723 724 // HasFuncOnClicked returns true if the function "WEBEXT.browserAction.onClicked.addListener" exists. 725 func HasFuncOnClicked() bool { 726 return js.True == bindings.HasFuncOnClicked() 727 } 728 729 // FuncOnClicked returns the function "WEBEXT.browserAction.onClicked.addListener". 730 func FuncOnClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)])]) { 731 bindings.FuncOnClicked( 732 js.Pointer(&fn), 733 ) 734 return 735 } 736 737 // OnClicked calls the function "WEBEXT.browserAction.onClicked.addListener" directly. 738 func OnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void) { 739 bindings.CallOnClicked( 740 js.Pointer(&ret), 741 callback.Ref(), 742 ) 743 744 return 745 } 746 747 // TryOnClicked calls the function "WEBEXT.browserAction.onClicked.addListener" 748 // in a try/catch block and returns (_, err, ok = false) when it went through 749 // the catch clause. 750 func TryOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void, exception js.Any, ok bool) { 751 ok = js.True == bindings.TryOnClicked( 752 js.Pointer(&ret), js.Pointer(&exception), 753 callback.Ref(), 754 ) 755 756 return 757 } 758 759 // HasFuncOffClicked returns true if the function "WEBEXT.browserAction.onClicked.removeListener" exists. 760 func HasFuncOffClicked() bool { 761 return js.True == bindings.HasFuncOffClicked() 762 } 763 764 // FuncOffClicked returns the function "WEBEXT.browserAction.onClicked.removeListener". 765 func FuncOffClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)])]) { 766 bindings.FuncOffClicked( 767 js.Pointer(&fn), 768 ) 769 return 770 } 771 772 // OffClicked calls the function "WEBEXT.browserAction.onClicked.removeListener" directly. 773 func OffClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void) { 774 bindings.CallOffClicked( 775 js.Pointer(&ret), 776 callback.Ref(), 777 ) 778 779 return 780 } 781 782 // TryOffClicked calls the function "WEBEXT.browserAction.onClicked.removeListener" 783 // in a try/catch block and returns (_, err, ok = false) when it went through 784 // the catch clause. 785 func TryOffClicked(callback js.Func[func(tab *tabs.Tab)]) (ret js.Void, exception js.Any, ok bool) { 786 ok = js.True == bindings.TryOffClicked( 787 js.Pointer(&ret), js.Pointer(&exception), 788 callback.Ref(), 789 ) 790 791 return 792 } 793 794 // HasFuncHasOnClicked returns true if the function "WEBEXT.browserAction.onClicked.hasListener" exists. 795 func HasFuncHasOnClicked() bool { 796 return js.True == bindings.HasFuncHasOnClicked() 797 } 798 799 // FuncHasOnClicked returns the function "WEBEXT.browserAction.onClicked.hasListener". 800 func FuncHasOnClicked() (fn js.Func[func(callback js.Func[func(tab *tabs.Tab)]) bool]) { 801 bindings.FuncHasOnClicked( 802 js.Pointer(&fn), 803 ) 804 return 805 } 806 807 // HasOnClicked calls the function "WEBEXT.browserAction.onClicked.hasListener" directly. 808 func HasOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret bool) { 809 bindings.CallHasOnClicked( 810 js.Pointer(&ret), 811 callback.Ref(), 812 ) 813 814 return 815 } 816 817 // TryHasOnClicked calls the function "WEBEXT.browserAction.onClicked.hasListener" 818 // in a try/catch block and returns (_, err, ok = false) when it went through 819 // the catch clause. 820 func TryHasOnClicked(callback js.Func[func(tab *tabs.Tab)]) (ret bool, exception js.Any, ok bool) { 821 ok = js.True == bindings.TryHasOnClicked( 822 js.Pointer(&ret), js.Pointer(&exception), 823 callback.Ref(), 824 ) 825 826 return 827 } 828 829 // HasFuncOpenPopup returns true if the function "WEBEXT.browserAction.openPopup" exists. 830 func HasFuncOpenPopup() bool { 831 return js.True == bindings.HasFuncOpenPopup() 832 } 833 834 // FuncOpenPopup returns the function "WEBEXT.browserAction.openPopup". 835 func FuncOpenPopup() (fn js.Func[func() js.Promise[js.Any]]) { 836 bindings.FuncOpenPopup( 837 js.Pointer(&fn), 838 ) 839 return 840 } 841 842 // OpenPopup calls the function "WEBEXT.browserAction.openPopup" directly. 843 func OpenPopup() (ret js.Promise[js.Any]) { 844 bindings.CallOpenPopup( 845 js.Pointer(&ret), 846 ) 847 848 return 849 } 850 851 // TryOpenPopup calls the function "WEBEXT.browserAction.openPopup" 852 // in a try/catch block and returns (_, err, ok = false) when it went through 853 // the catch clause. 854 func TryOpenPopup() (ret js.Promise[js.Any], exception js.Any, ok bool) { 855 ok = js.True == bindings.TryOpenPopup( 856 js.Pointer(&ret), js.Pointer(&exception), 857 ) 858 859 return 860 } 861 862 // HasFuncSetBadgeBackgroundColor returns true if the function "WEBEXT.browserAction.setBadgeBackgroundColor" exists. 863 func HasFuncSetBadgeBackgroundColor() bool { 864 return js.True == bindings.HasFuncSetBadgeBackgroundColor() 865 } 866 867 // FuncSetBadgeBackgroundColor returns the function "WEBEXT.browserAction.setBadgeBackgroundColor". 868 func FuncSetBadgeBackgroundColor() (fn js.Func[func(details SetBadgeBackgroundColorArgDetails) js.Promise[js.Void]]) { 869 bindings.FuncSetBadgeBackgroundColor( 870 js.Pointer(&fn), 871 ) 872 return 873 } 874 875 // SetBadgeBackgroundColor calls the function "WEBEXT.browserAction.setBadgeBackgroundColor" directly. 876 func SetBadgeBackgroundColor(details SetBadgeBackgroundColorArgDetails) (ret js.Promise[js.Void]) { 877 bindings.CallSetBadgeBackgroundColor( 878 js.Pointer(&ret), 879 js.Pointer(&details), 880 ) 881 882 return 883 } 884 885 // TrySetBadgeBackgroundColor calls the function "WEBEXT.browserAction.setBadgeBackgroundColor" 886 // in a try/catch block and returns (_, err, ok = false) when it went through 887 // the catch clause. 888 func TrySetBadgeBackgroundColor(details SetBadgeBackgroundColorArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 889 ok = js.True == bindings.TrySetBadgeBackgroundColor( 890 js.Pointer(&ret), js.Pointer(&exception), 891 js.Pointer(&details), 892 ) 893 894 return 895 } 896 897 // HasFuncSetBadgeText returns true if the function "WEBEXT.browserAction.setBadgeText" exists. 898 func HasFuncSetBadgeText() bool { 899 return js.True == bindings.HasFuncSetBadgeText() 900 } 901 902 // FuncSetBadgeText returns the function "WEBEXT.browserAction.setBadgeText". 903 func FuncSetBadgeText() (fn js.Func[func(details SetBadgeTextArgDetails) js.Promise[js.Void]]) { 904 bindings.FuncSetBadgeText( 905 js.Pointer(&fn), 906 ) 907 return 908 } 909 910 // SetBadgeText calls the function "WEBEXT.browserAction.setBadgeText" directly. 911 func SetBadgeText(details SetBadgeTextArgDetails) (ret js.Promise[js.Void]) { 912 bindings.CallSetBadgeText( 913 js.Pointer(&ret), 914 js.Pointer(&details), 915 ) 916 917 return 918 } 919 920 // TrySetBadgeText calls the function "WEBEXT.browserAction.setBadgeText" 921 // in a try/catch block and returns (_, err, ok = false) when it went through 922 // the catch clause. 923 func TrySetBadgeText(details SetBadgeTextArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 924 ok = js.True == bindings.TrySetBadgeText( 925 js.Pointer(&ret), js.Pointer(&exception), 926 js.Pointer(&details), 927 ) 928 929 return 930 } 931 932 // HasFuncSetIcon returns true if the function "WEBEXT.browserAction.setIcon" exists. 933 func HasFuncSetIcon() bool { 934 return js.True == bindings.HasFuncSetIcon() 935 } 936 937 // FuncSetIcon returns the function "WEBEXT.browserAction.setIcon". 938 func FuncSetIcon() (fn js.Func[func(details SetIconArgDetails) js.Promise[js.Void]]) { 939 bindings.FuncSetIcon( 940 js.Pointer(&fn), 941 ) 942 return 943 } 944 945 // SetIcon calls the function "WEBEXT.browserAction.setIcon" directly. 946 func SetIcon(details SetIconArgDetails) (ret js.Promise[js.Void]) { 947 bindings.CallSetIcon( 948 js.Pointer(&ret), 949 js.Pointer(&details), 950 ) 951 952 return 953 } 954 955 // TrySetIcon calls the function "WEBEXT.browserAction.setIcon" 956 // in a try/catch block and returns (_, err, ok = false) when it went through 957 // the catch clause. 958 func TrySetIcon(details SetIconArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 959 ok = js.True == bindings.TrySetIcon( 960 js.Pointer(&ret), js.Pointer(&exception), 961 js.Pointer(&details), 962 ) 963 964 return 965 } 966 967 // HasFuncSetPopup returns true if the function "WEBEXT.browserAction.setPopup" exists. 968 func HasFuncSetPopup() bool { 969 return js.True == bindings.HasFuncSetPopup() 970 } 971 972 // FuncSetPopup returns the function "WEBEXT.browserAction.setPopup". 973 func FuncSetPopup() (fn js.Func[func(details SetPopupArgDetails) js.Promise[js.Void]]) { 974 bindings.FuncSetPopup( 975 js.Pointer(&fn), 976 ) 977 return 978 } 979 980 // SetPopup calls the function "WEBEXT.browserAction.setPopup" directly. 981 func SetPopup(details SetPopupArgDetails) (ret js.Promise[js.Void]) { 982 bindings.CallSetPopup( 983 js.Pointer(&ret), 984 js.Pointer(&details), 985 ) 986 987 return 988 } 989 990 // TrySetPopup calls the function "WEBEXT.browserAction.setPopup" 991 // in a try/catch block and returns (_, err, ok = false) when it went through 992 // the catch clause. 993 func TrySetPopup(details SetPopupArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 994 ok = js.True == bindings.TrySetPopup( 995 js.Pointer(&ret), js.Pointer(&exception), 996 js.Pointer(&details), 997 ) 998 999 return 1000 } 1001 1002 // HasFuncSetTitle returns true if the function "WEBEXT.browserAction.setTitle" exists. 1003 func HasFuncSetTitle() bool { 1004 return js.True == bindings.HasFuncSetTitle() 1005 } 1006 1007 // FuncSetTitle returns the function "WEBEXT.browserAction.setTitle". 1008 func FuncSetTitle() (fn js.Func[func(details SetTitleArgDetails) js.Promise[js.Void]]) { 1009 bindings.FuncSetTitle( 1010 js.Pointer(&fn), 1011 ) 1012 return 1013 } 1014 1015 // SetTitle calls the function "WEBEXT.browserAction.setTitle" directly. 1016 func SetTitle(details SetTitleArgDetails) (ret js.Promise[js.Void]) { 1017 bindings.CallSetTitle( 1018 js.Pointer(&ret), 1019 js.Pointer(&details), 1020 ) 1021 1022 return 1023 } 1024 1025 // TrySetTitle calls the function "WEBEXT.browserAction.setTitle" 1026 // in a try/catch block and returns (_, err, ok = false) when it went through 1027 // the catch clause. 1028 func TrySetTitle(details SetTitleArgDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 1029 ok = js.True == bindings.TrySetTitle( 1030 js.Pointer(&ret), js.Pointer(&exception), 1031 js.Pointer(&details), 1032 ) 1033 1034 return 1035 }