github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/tabgroups/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package tabgroups 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/tabgroups/bindings" 11 ) 12 13 type Color uint32 14 15 const ( 16 _ Color = iota 17 18 Color_GREY 19 Color_BLUE 20 Color_RED 21 Color_YELLOW 22 Color_GREEN 23 Color_PINK 24 Color_PURPLE 25 Color_CYAN 26 Color_ORANGE 27 ) 28 29 func (Color) FromRef(str js.Ref) Color { 30 return Color(bindings.ConstOfColor(str)) 31 } 32 33 func (x Color) String() (string, bool) { 34 switch x { 35 case Color_GREY: 36 return "grey", true 37 case Color_BLUE: 38 return "blue", true 39 case Color_RED: 40 return "red", true 41 case Color_YELLOW: 42 return "yellow", true 43 case Color_GREEN: 44 return "green", true 45 case Color_PINK: 46 return "pink", true 47 case Color_PURPLE: 48 return "purple", true 49 case Color_CYAN: 50 return "cyan", true 51 case Color_ORANGE: 52 return "orange", true 53 default: 54 return "", false 55 } 56 } 57 58 type MoveArgMoveProperties struct { 59 // Index is "MoveArgMoveProperties.index" 60 // 61 // Required 62 Index int64 63 // WindowId is "MoveArgMoveProperties.windowId" 64 // 65 // Optional 66 // 67 // NOTE: FFI_USE_WindowId MUST be set to true to make this field effective. 68 WindowId int64 69 70 FFI_USE_WindowId bool // for WindowId. 71 72 FFI_USE bool 73 } 74 75 // FromRef calls UpdateFrom and returns a MoveArgMoveProperties with all fields set. 76 func (p MoveArgMoveProperties) FromRef(ref js.Ref) MoveArgMoveProperties { 77 p.UpdateFrom(ref) 78 return p 79 } 80 81 // New creates a new MoveArgMoveProperties in the application heap. 82 func (p MoveArgMoveProperties) New() js.Ref { 83 return bindings.MoveArgMovePropertiesJSLoad( 84 js.Pointer(&p), js.True, 0, 85 ) 86 } 87 88 // UpdateFrom copies value of all fields of the heap object to p. 89 func (p *MoveArgMoveProperties) UpdateFrom(ref js.Ref) { 90 bindings.MoveArgMovePropertiesJSStore( 91 js.Pointer(p), ref, 92 ) 93 } 94 95 // Update writes all fields of the p to the heap object referenced by ref. 96 func (p *MoveArgMoveProperties) Update(ref js.Ref) { 97 bindings.MoveArgMovePropertiesJSLoad( 98 js.Pointer(p), js.False, ref, 99 ) 100 } 101 102 // FreeMembers frees fields with heap reference, if recursive is true 103 // free all heap references reachable from p. 104 func (p *MoveArgMoveProperties) FreeMembers(recursive bool) { 105 } 106 107 type QueryArgQueryInfo struct { 108 // Collapsed is "QueryArgQueryInfo.collapsed" 109 // 110 // Optional 111 // 112 // NOTE: FFI_USE_Collapsed MUST be set to true to make this field effective. 113 Collapsed bool 114 // Color is "QueryArgQueryInfo.color" 115 // 116 // Optional 117 Color Color 118 // Title is "QueryArgQueryInfo.title" 119 // 120 // Optional 121 Title js.String 122 // WindowId is "QueryArgQueryInfo.windowId" 123 // 124 // Optional 125 // 126 // NOTE: FFI_USE_WindowId MUST be set to true to make this field effective. 127 WindowId int64 128 129 FFI_USE_Collapsed bool // for Collapsed. 130 FFI_USE_WindowId bool // for WindowId. 131 132 FFI_USE bool 133 } 134 135 // FromRef calls UpdateFrom and returns a QueryArgQueryInfo with all fields set. 136 func (p QueryArgQueryInfo) FromRef(ref js.Ref) QueryArgQueryInfo { 137 p.UpdateFrom(ref) 138 return p 139 } 140 141 // New creates a new QueryArgQueryInfo in the application heap. 142 func (p QueryArgQueryInfo) New() js.Ref { 143 return bindings.QueryArgQueryInfoJSLoad( 144 js.Pointer(&p), js.True, 0, 145 ) 146 } 147 148 // UpdateFrom copies value of all fields of the heap object to p. 149 func (p *QueryArgQueryInfo) UpdateFrom(ref js.Ref) { 150 bindings.QueryArgQueryInfoJSStore( 151 js.Pointer(p), ref, 152 ) 153 } 154 155 // Update writes all fields of the p to the heap object referenced by ref. 156 func (p *QueryArgQueryInfo) Update(ref js.Ref) { 157 bindings.QueryArgQueryInfoJSLoad( 158 js.Pointer(p), js.False, ref, 159 ) 160 } 161 162 // FreeMembers frees fields with heap reference, if recursive is true 163 // free all heap references reachable from p. 164 func (p *QueryArgQueryInfo) FreeMembers(recursive bool) { 165 js.Free( 166 p.Title.Ref(), 167 ) 168 p.Title = p.Title.FromRef(js.Undefined) 169 } 170 171 // TAB_GROUP_ID_NONE returns the value of property "WEBEXT.tabGroups.TAB_GROUP_ID_NONE". 172 // 173 // The returned bool will be false if there is no such property. 174 func TAB_GROUP_ID_NONE() (ret js.String, ok bool) { 175 ok = js.True == bindings.GetTAB_GROUP_ID_NONE( 176 js.Pointer(&ret), 177 ) 178 179 return 180 } 181 182 // SetTAB_GROUP_ID_NONE sets the value of property "WEBEXT.tabGroups.TAB_GROUP_ID_NONE" to val. 183 // 184 // It returns false if the property cannot be set. 185 func SetTAB_GROUP_ID_NONE(val js.String) bool { 186 return js.True == bindings.SetTAB_GROUP_ID_NONE( 187 val.Ref()) 188 } 189 190 type TabGroup struct { 191 // Collapsed is "TabGroup.collapsed" 192 // 193 // Required 194 Collapsed bool 195 // Color is "TabGroup.color" 196 // 197 // Required 198 Color Color 199 // Id is "TabGroup.id" 200 // 201 // Required 202 Id int64 203 // Title is "TabGroup.title" 204 // 205 // Optional 206 Title js.String 207 // WindowId is "TabGroup.windowId" 208 // 209 // Required 210 WindowId int64 211 212 FFI_USE bool 213 } 214 215 // FromRef calls UpdateFrom and returns a TabGroup with all fields set. 216 func (p TabGroup) FromRef(ref js.Ref) TabGroup { 217 p.UpdateFrom(ref) 218 return p 219 } 220 221 // New creates a new TabGroup in the application heap. 222 func (p TabGroup) New() js.Ref { 223 return bindings.TabGroupJSLoad( 224 js.Pointer(&p), js.True, 0, 225 ) 226 } 227 228 // UpdateFrom copies value of all fields of the heap object to p. 229 func (p *TabGroup) UpdateFrom(ref js.Ref) { 230 bindings.TabGroupJSStore( 231 js.Pointer(p), ref, 232 ) 233 } 234 235 // Update writes all fields of the p to the heap object referenced by ref. 236 func (p *TabGroup) Update(ref js.Ref) { 237 bindings.TabGroupJSLoad( 238 js.Pointer(p), js.False, ref, 239 ) 240 } 241 242 // FreeMembers frees fields with heap reference, if recursive is true 243 // free all heap references reachable from p. 244 func (p *TabGroup) FreeMembers(recursive bool) { 245 js.Free( 246 p.Title.Ref(), 247 ) 248 p.Title = p.Title.FromRef(js.Undefined) 249 } 250 251 type UpdateArgUpdateProperties struct { 252 // Collapsed is "UpdateArgUpdateProperties.collapsed" 253 // 254 // Optional 255 // 256 // NOTE: FFI_USE_Collapsed MUST be set to true to make this field effective. 257 Collapsed bool 258 // Color is "UpdateArgUpdateProperties.color" 259 // 260 // Optional 261 Color Color 262 // Title is "UpdateArgUpdateProperties.title" 263 // 264 // Optional 265 Title js.String 266 267 FFI_USE_Collapsed bool // for Collapsed. 268 269 FFI_USE bool 270 } 271 272 // FromRef calls UpdateFrom and returns a UpdateArgUpdateProperties with all fields set. 273 func (p UpdateArgUpdateProperties) FromRef(ref js.Ref) UpdateArgUpdateProperties { 274 p.UpdateFrom(ref) 275 return p 276 } 277 278 // New creates a new UpdateArgUpdateProperties in the application heap. 279 func (p UpdateArgUpdateProperties) New() js.Ref { 280 return bindings.UpdateArgUpdatePropertiesJSLoad( 281 js.Pointer(&p), js.True, 0, 282 ) 283 } 284 285 // UpdateFrom copies value of all fields of the heap object to p. 286 func (p *UpdateArgUpdateProperties) UpdateFrom(ref js.Ref) { 287 bindings.UpdateArgUpdatePropertiesJSStore( 288 js.Pointer(p), ref, 289 ) 290 } 291 292 // Update writes all fields of the p to the heap object referenced by ref. 293 func (p *UpdateArgUpdateProperties) Update(ref js.Ref) { 294 bindings.UpdateArgUpdatePropertiesJSLoad( 295 js.Pointer(p), js.False, ref, 296 ) 297 } 298 299 // FreeMembers frees fields with heap reference, if recursive is true 300 // free all heap references reachable from p. 301 func (p *UpdateArgUpdateProperties) FreeMembers(recursive bool) { 302 js.Free( 303 p.Title.Ref(), 304 ) 305 p.Title = p.Title.FromRef(js.Undefined) 306 } 307 308 // HasFuncGet returns true if the function "WEBEXT.tabGroups.get" exists. 309 func HasFuncGet() bool { 310 return js.True == bindings.HasFuncGet() 311 } 312 313 // FuncGet returns the function "WEBEXT.tabGroups.get". 314 func FuncGet() (fn js.Func[func(groupId int64) js.Promise[TabGroup]]) { 315 bindings.FuncGet( 316 js.Pointer(&fn), 317 ) 318 return 319 } 320 321 // Get calls the function "WEBEXT.tabGroups.get" directly. 322 func Get(groupId int64) (ret js.Promise[TabGroup]) { 323 bindings.CallGet( 324 js.Pointer(&ret), 325 float64(groupId), 326 ) 327 328 return 329 } 330 331 // TryGet calls the function "WEBEXT.tabGroups.get" 332 // in a try/catch block and returns (_, err, ok = false) when it went through 333 // the catch clause. 334 func TryGet(groupId int64) (ret js.Promise[TabGroup], exception js.Any, ok bool) { 335 ok = js.True == bindings.TryGet( 336 js.Pointer(&ret), js.Pointer(&exception), 337 float64(groupId), 338 ) 339 340 return 341 } 342 343 // HasFuncMove returns true if the function "WEBEXT.tabGroups.move" exists. 344 func HasFuncMove() bool { 345 return js.True == bindings.HasFuncMove() 346 } 347 348 // FuncMove returns the function "WEBEXT.tabGroups.move". 349 func FuncMove() (fn js.Func[func(groupId int64, moveProperties MoveArgMoveProperties) js.Promise[TabGroup]]) { 350 bindings.FuncMove( 351 js.Pointer(&fn), 352 ) 353 return 354 } 355 356 // Move calls the function "WEBEXT.tabGroups.move" directly. 357 func Move(groupId int64, moveProperties MoveArgMoveProperties) (ret js.Promise[TabGroup]) { 358 bindings.CallMove( 359 js.Pointer(&ret), 360 float64(groupId), 361 js.Pointer(&moveProperties), 362 ) 363 364 return 365 } 366 367 // TryMove calls the function "WEBEXT.tabGroups.move" 368 // in a try/catch block and returns (_, err, ok = false) when it went through 369 // the catch clause. 370 func TryMove(groupId int64, moveProperties MoveArgMoveProperties) (ret js.Promise[TabGroup], exception js.Any, ok bool) { 371 ok = js.True == bindings.TryMove( 372 js.Pointer(&ret), js.Pointer(&exception), 373 float64(groupId), 374 js.Pointer(&moveProperties), 375 ) 376 377 return 378 } 379 380 type OnCreatedEventCallbackFunc func(this js.Ref, group *TabGroup) js.Ref 381 382 func (fn OnCreatedEventCallbackFunc) Register() js.Func[func(group *TabGroup)] { 383 return js.RegisterCallback[func(group *TabGroup)]( 384 fn, abi.FuncPCABIInternal(fn), 385 ) 386 } 387 388 func (fn OnCreatedEventCallbackFunc) DispatchCallback( 389 targetPC uintptr, ctx *js.CallbackContext, 390 ) { 391 args := ctx.Args() 392 if len(args) != 1+1 /* js this */ || 393 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 394 js.ThrowInvalidCallbackInvocation() 395 } 396 var arg0 TabGroup 397 arg0.UpdateFrom(args[0+1]) 398 defer arg0.FreeMembers(true) 399 400 if ctx.Return(fn( 401 args[0], 402 403 mark.NoEscape(&arg0), 404 )) { 405 return 406 } 407 408 js.ThrowCallbackValueNotReturned() 409 } 410 411 type OnCreatedEventCallback[T any] struct { 412 Fn func(arg T, this js.Ref, group *TabGroup) js.Ref 413 Arg T 414 } 415 416 func (cb *OnCreatedEventCallback[T]) Register() js.Func[func(group *TabGroup)] { 417 return js.RegisterCallback[func(group *TabGroup)]( 418 cb, abi.FuncPCABIInternal(cb.Fn), 419 ) 420 } 421 422 func (cb *OnCreatedEventCallback[T]) DispatchCallback( 423 targetPC uintptr, ctx *js.CallbackContext, 424 ) { 425 args := ctx.Args() 426 if len(args) != 1+1 /* js this */ || 427 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 428 js.ThrowInvalidCallbackInvocation() 429 } 430 var arg0 TabGroup 431 arg0.UpdateFrom(args[0+1]) 432 defer arg0.FreeMembers(true) 433 434 if ctx.Return(cb.Fn( 435 cb.Arg, 436 args[0], 437 438 mark.NoEscape(&arg0), 439 )) { 440 return 441 } 442 443 js.ThrowCallbackValueNotReturned() 444 } 445 446 // HasFuncOnCreated returns true if the function "WEBEXT.tabGroups.onCreated.addListener" exists. 447 func HasFuncOnCreated() bool { 448 return js.True == bindings.HasFuncOnCreated() 449 } 450 451 // FuncOnCreated returns the function "WEBEXT.tabGroups.onCreated.addListener". 452 func FuncOnCreated() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 453 bindings.FuncOnCreated( 454 js.Pointer(&fn), 455 ) 456 return 457 } 458 459 // OnCreated calls the function "WEBEXT.tabGroups.onCreated.addListener" directly. 460 func OnCreated(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 461 bindings.CallOnCreated( 462 js.Pointer(&ret), 463 callback.Ref(), 464 ) 465 466 return 467 } 468 469 // TryOnCreated calls the function "WEBEXT.tabGroups.onCreated.addListener" 470 // in a try/catch block and returns (_, err, ok = false) when it went through 471 // the catch clause. 472 func TryOnCreated(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 473 ok = js.True == bindings.TryOnCreated( 474 js.Pointer(&ret), js.Pointer(&exception), 475 callback.Ref(), 476 ) 477 478 return 479 } 480 481 // HasFuncOffCreated returns true if the function "WEBEXT.tabGroups.onCreated.removeListener" exists. 482 func HasFuncOffCreated() bool { 483 return js.True == bindings.HasFuncOffCreated() 484 } 485 486 // FuncOffCreated returns the function "WEBEXT.tabGroups.onCreated.removeListener". 487 func FuncOffCreated() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 488 bindings.FuncOffCreated( 489 js.Pointer(&fn), 490 ) 491 return 492 } 493 494 // OffCreated calls the function "WEBEXT.tabGroups.onCreated.removeListener" directly. 495 func OffCreated(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 496 bindings.CallOffCreated( 497 js.Pointer(&ret), 498 callback.Ref(), 499 ) 500 501 return 502 } 503 504 // TryOffCreated calls the function "WEBEXT.tabGroups.onCreated.removeListener" 505 // in a try/catch block and returns (_, err, ok = false) when it went through 506 // the catch clause. 507 func TryOffCreated(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 508 ok = js.True == bindings.TryOffCreated( 509 js.Pointer(&ret), js.Pointer(&exception), 510 callback.Ref(), 511 ) 512 513 return 514 } 515 516 // HasFuncHasOnCreated returns true if the function "WEBEXT.tabGroups.onCreated.hasListener" exists. 517 func HasFuncHasOnCreated() bool { 518 return js.True == bindings.HasFuncHasOnCreated() 519 } 520 521 // FuncHasOnCreated returns the function "WEBEXT.tabGroups.onCreated.hasListener". 522 func FuncHasOnCreated() (fn js.Func[func(callback js.Func[func(group *TabGroup)]) bool]) { 523 bindings.FuncHasOnCreated( 524 js.Pointer(&fn), 525 ) 526 return 527 } 528 529 // HasOnCreated calls the function "WEBEXT.tabGroups.onCreated.hasListener" directly. 530 func HasOnCreated(callback js.Func[func(group *TabGroup)]) (ret bool) { 531 bindings.CallHasOnCreated( 532 js.Pointer(&ret), 533 callback.Ref(), 534 ) 535 536 return 537 } 538 539 // TryHasOnCreated calls the function "WEBEXT.tabGroups.onCreated.hasListener" 540 // in a try/catch block and returns (_, err, ok = false) when it went through 541 // the catch clause. 542 func TryHasOnCreated(callback js.Func[func(group *TabGroup)]) (ret bool, exception js.Any, ok bool) { 543 ok = js.True == bindings.TryHasOnCreated( 544 js.Pointer(&ret), js.Pointer(&exception), 545 callback.Ref(), 546 ) 547 548 return 549 } 550 551 type OnMovedEventCallbackFunc func(this js.Ref, group *TabGroup) js.Ref 552 553 func (fn OnMovedEventCallbackFunc) Register() js.Func[func(group *TabGroup)] { 554 return js.RegisterCallback[func(group *TabGroup)]( 555 fn, abi.FuncPCABIInternal(fn), 556 ) 557 } 558 559 func (fn OnMovedEventCallbackFunc) DispatchCallback( 560 targetPC uintptr, ctx *js.CallbackContext, 561 ) { 562 args := ctx.Args() 563 if len(args) != 1+1 /* js this */ || 564 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 565 js.ThrowInvalidCallbackInvocation() 566 } 567 var arg0 TabGroup 568 arg0.UpdateFrom(args[0+1]) 569 defer arg0.FreeMembers(true) 570 571 if ctx.Return(fn( 572 args[0], 573 574 mark.NoEscape(&arg0), 575 )) { 576 return 577 } 578 579 js.ThrowCallbackValueNotReturned() 580 } 581 582 type OnMovedEventCallback[T any] struct { 583 Fn func(arg T, this js.Ref, group *TabGroup) js.Ref 584 Arg T 585 } 586 587 func (cb *OnMovedEventCallback[T]) Register() js.Func[func(group *TabGroup)] { 588 return js.RegisterCallback[func(group *TabGroup)]( 589 cb, abi.FuncPCABIInternal(cb.Fn), 590 ) 591 } 592 593 func (cb *OnMovedEventCallback[T]) DispatchCallback( 594 targetPC uintptr, ctx *js.CallbackContext, 595 ) { 596 args := ctx.Args() 597 if len(args) != 1+1 /* js this */ || 598 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 599 js.ThrowInvalidCallbackInvocation() 600 } 601 var arg0 TabGroup 602 arg0.UpdateFrom(args[0+1]) 603 defer arg0.FreeMembers(true) 604 605 if ctx.Return(cb.Fn( 606 cb.Arg, 607 args[0], 608 609 mark.NoEscape(&arg0), 610 )) { 611 return 612 } 613 614 js.ThrowCallbackValueNotReturned() 615 } 616 617 // HasFuncOnMoved returns true if the function "WEBEXT.tabGroups.onMoved.addListener" exists. 618 func HasFuncOnMoved() bool { 619 return js.True == bindings.HasFuncOnMoved() 620 } 621 622 // FuncOnMoved returns the function "WEBEXT.tabGroups.onMoved.addListener". 623 func FuncOnMoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 624 bindings.FuncOnMoved( 625 js.Pointer(&fn), 626 ) 627 return 628 } 629 630 // OnMoved calls the function "WEBEXT.tabGroups.onMoved.addListener" directly. 631 func OnMoved(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 632 bindings.CallOnMoved( 633 js.Pointer(&ret), 634 callback.Ref(), 635 ) 636 637 return 638 } 639 640 // TryOnMoved calls the function "WEBEXT.tabGroups.onMoved.addListener" 641 // in a try/catch block and returns (_, err, ok = false) when it went through 642 // the catch clause. 643 func TryOnMoved(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 644 ok = js.True == bindings.TryOnMoved( 645 js.Pointer(&ret), js.Pointer(&exception), 646 callback.Ref(), 647 ) 648 649 return 650 } 651 652 // HasFuncOffMoved returns true if the function "WEBEXT.tabGroups.onMoved.removeListener" exists. 653 func HasFuncOffMoved() bool { 654 return js.True == bindings.HasFuncOffMoved() 655 } 656 657 // FuncOffMoved returns the function "WEBEXT.tabGroups.onMoved.removeListener". 658 func FuncOffMoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 659 bindings.FuncOffMoved( 660 js.Pointer(&fn), 661 ) 662 return 663 } 664 665 // OffMoved calls the function "WEBEXT.tabGroups.onMoved.removeListener" directly. 666 func OffMoved(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 667 bindings.CallOffMoved( 668 js.Pointer(&ret), 669 callback.Ref(), 670 ) 671 672 return 673 } 674 675 // TryOffMoved calls the function "WEBEXT.tabGroups.onMoved.removeListener" 676 // in a try/catch block and returns (_, err, ok = false) when it went through 677 // the catch clause. 678 func TryOffMoved(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 679 ok = js.True == bindings.TryOffMoved( 680 js.Pointer(&ret), js.Pointer(&exception), 681 callback.Ref(), 682 ) 683 684 return 685 } 686 687 // HasFuncHasOnMoved returns true if the function "WEBEXT.tabGroups.onMoved.hasListener" exists. 688 func HasFuncHasOnMoved() bool { 689 return js.True == bindings.HasFuncHasOnMoved() 690 } 691 692 // FuncHasOnMoved returns the function "WEBEXT.tabGroups.onMoved.hasListener". 693 func FuncHasOnMoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)]) bool]) { 694 bindings.FuncHasOnMoved( 695 js.Pointer(&fn), 696 ) 697 return 698 } 699 700 // HasOnMoved calls the function "WEBEXT.tabGroups.onMoved.hasListener" directly. 701 func HasOnMoved(callback js.Func[func(group *TabGroup)]) (ret bool) { 702 bindings.CallHasOnMoved( 703 js.Pointer(&ret), 704 callback.Ref(), 705 ) 706 707 return 708 } 709 710 // TryHasOnMoved calls the function "WEBEXT.tabGroups.onMoved.hasListener" 711 // in a try/catch block and returns (_, err, ok = false) when it went through 712 // the catch clause. 713 func TryHasOnMoved(callback js.Func[func(group *TabGroup)]) (ret bool, exception js.Any, ok bool) { 714 ok = js.True == bindings.TryHasOnMoved( 715 js.Pointer(&ret), js.Pointer(&exception), 716 callback.Ref(), 717 ) 718 719 return 720 } 721 722 type OnRemovedEventCallbackFunc func(this js.Ref, group *TabGroup) js.Ref 723 724 func (fn OnRemovedEventCallbackFunc) Register() js.Func[func(group *TabGroup)] { 725 return js.RegisterCallback[func(group *TabGroup)]( 726 fn, abi.FuncPCABIInternal(fn), 727 ) 728 } 729 730 func (fn OnRemovedEventCallbackFunc) DispatchCallback( 731 targetPC uintptr, ctx *js.CallbackContext, 732 ) { 733 args := ctx.Args() 734 if len(args) != 1+1 /* js this */ || 735 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 736 js.ThrowInvalidCallbackInvocation() 737 } 738 var arg0 TabGroup 739 arg0.UpdateFrom(args[0+1]) 740 defer arg0.FreeMembers(true) 741 742 if ctx.Return(fn( 743 args[0], 744 745 mark.NoEscape(&arg0), 746 )) { 747 return 748 } 749 750 js.ThrowCallbackValueNotReturned() 751 } 752 753 type OnRemovedEventCallback[T any] struct { 754 Fn func(arg T, this js.Ref, group *TabGroup) js.Ref 755 Arg T 756 } 757 758 func (cb *OnRemovedEventCallback[T]) Register() js.Func[func(group *TabGroup)] { 759 return js.RegisterCallback[func(group *TabGroup)]( 760 cb, abi.FuncPCABIInternal(cb.Fn), 761 ) 762 } 763 764 func (cb *OnRemovedEventCallback[T]) DispatchCallback( 765 targetPC uintptr, ctx *js.CallbackContext, 766 ) { 767 args := ctx.Args() 768 if len(args) != 1+1 /* js this */ || 769 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 770 js.ThrowInvalidCallbackInvocation() 771 } 772 var arg0 TabGroup 773 arg0.UpdateFrom(args[0+1]) 774 defer arg0.FreeMembers(true) 775 776 if ctx.Return(cb.Fn( 777 cb.Arg, 778 args[0], 779 780 mark.NoEscape(&arg0), 781 )) { 782 return 783 } 784 785 js.ThrowCallbackValueNotReturned() 786 } 787 788 // HasFuncOnRemoved returns true if the function "WEBEXT.tabGroups.onRemoved.addListener" exists. 789 func HasFuncOnRemoved() bool { 790 return js.True == bindings.HasFuncOnRemoved() 791 } 792 793 // FuncOnRemoved returns the function "WEBEXT.tabGroups.onRemoved.addListener". 794 func FuncOnRemoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 795 bindings.FuncOnRemoved( 796 js.Pointer(&fn), 797 ) 798 return 799 } 800 801 // OnRemoved calls the function "WEBEXT.tabGroups.onRemoved.addListener" directly. 802 func OnRemoved(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 803 bindings.CallOnRemoved( 804 js.Pointer(&ret), 805 callback.Ref(), 806 ) 807 808 return 809 } 810 811 // TryOnRemoved calls the function "WEBEXT.tabGroups.onRemoved.addListener" 812 // in a try/catch block and returns (_, err, ok = false) when it went through 813 // the catch clause. 814 func TryOnRemoved(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 815 ok = js.True == bindings.TryOnRemoved( 816 js.Pointer(&ret), js.Pointer(&exception), 817 callback.Ref(), 818 ) 819 820 return 821 } 822 823 // HasFuncOffRemoved returns true if the function "WEBEXT.tabGroups.onRemoved.removeListener" exists. 824 func HasFuncOffRemoved() bool { 825 return js.True == bindings.HasFuncOffRemoved() 826 } 827 828 // FuncOffRemoved returns the function "WEBEXT.tabGroups.onRemoved.removeListener". 829 func FuncOffRemoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 830 bindings.FuncOffRemoved( 831 js.Pointer(&fn), 832 ) 833 return 834 } 835 836 // OffRemoved calls the function "WEBEXT.tabGroups.onRemoved.removeListener" directly. 837 func OffRemoved(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 838 bindings.CallOffRemoved( 839 js.Pointer(&ret), 840 callback.Ref(), 841 ) 842 843 return 844 } 845 846 // TryOffRemoved calls the function "WEBEXT.tabGroups.onRemoved.removeListener" 847 // in a try/catch block and returns (_, err, ok = false) when it went through 848 // the catch clause. 849 func TryOffRemoved(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 850 ok = js.True == bindings.TryOffRemoved( 851 js.Pointer(&ret), js.Pointer(&exception), 852 callback.Ref(), 853 ) 854 855 return 856 } 857 858 // HasFuncHasOnRemoved returns true if the function "WEBEXT.tabGroups.onRemoved.hasListener" exists. 859 func HasFuncHasOnRemoved() bool { 860 return js.True == bindings.HasFuncHasOnRemoved() 861 } 862 863 // FuncHasOnRemoved returns the function "WEBEXT.tabGroups.onRemoved.hasListener". 864 func FuncHasOnRemoved() (fn js.Func[func(callback js.Func[func(group *TabGroup)]) bool]) { 865 bindings.FuncHasOnRemoved( 866 js.Pointer(&fn), 867 ) 868 return 869 } 870 871 // HasOnRemoved calls the function "WEBEXT.tabGroups.onRemoved.hasListener" directly. 872 func HasOnRemoved(callback js.Func[func(group *TabGroup)]) (ret bool) { 873 bindings.CallHasOnRemoved( 874 js.Pointer(&ret), 875 callback.Ref(), 876 ) 877 878 return 879 } 880 881 // TryHasOnRemoved calls the function "WEBEXT.tabGroups.onRemoved.hasListener" 882 // in a try/catch block and returns (_, err, ok = false) when it went through 883 // the catch clause. 884 func TryHasOnRemoved(callback js.Func[func(group *TabGroup)]) (ret bool, exception js.Any, ok bool) { 885 ok = js.True == bindings.TryHasOnRemoved( 886 js.Pointer(&ret), js.Pointer(&exception), 887 callback.Ref(), 888 ) 889 890 return 891 } 892 893 type OnUpdatedEventCallbackFunc func(this js.Ref, group *TabGroup) js.Ref 894 895 func (fn OnUpdatedEventCallbackFunc) Register() js.Func[func(group *TabGroup)] { 896 return js.RegisterCallback[func(group *TabGroup)]( 897 fn, abi.FuncPCABIInternal(fn), 898 ) 899 } 900 901 func (fn OnUpdatedEventCallbackFunc) DispatchCallback( 902 targetPC uintptr, ctx *js.CallbackContext, 903 ) { 904 args := ctx.Args() 905 if len(args) != 1+1 /* js this */ || 906 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 907 js.ThrowInvalidCallbackInvocation() 908 } 909 var arg0 TabGroup 910 arg0.UpdateFrom(args[0+1]) 911 defer arg0.FreeMembers(true) 912 913 if ctx.Return(fn( 914 args[0], 915 916 mark.NoEscape(&arg0), 917 )) { 918 return 919 } 920 921 js.ThrowCallbackValueNotReturned() 922 } 923 924 type OnUpdatedEventCallback[T any] struct { 925 Fn func(arg T, this js.Ref, group *TabGroup) js.Ref 926 Arg T 927 } 928 929 func (cb *OnUpdatedEventCallback[T]) Register() js.Func[func(group *TabGroup)] { 930 return js.RegisterCallback[func(group *TabGroup)]( 931 cb, abi.FuncPCABIInternal(cb.Fn), 932 ) 933 } 934 935 func (cb *OnUpdatedEventCallback[T]) DispatchCallback( 936 targetPC uintptr, ctx *js.CallbackContext, 937 ) { 938 args := ctx.Args() 939 if len(args) != 1+1 /* js this */ || 940 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 941 js.ThrowInvalidCallbackInvocation() 942 } 943 var arg0 TabGroup 944 arg0.UpdateFrom(args[0+1]) 945 defer arg0.FreeMembers(true) 946 947 if ctx.Return(cb.Fn( 948 cb.Arg, 949 args[0], 950 951 mark.NoEscape(&arg0), 952 )) { 953 return 954 } 955 956 js.ThrowCallbackValueNotReturned() 957 } 958 959 // HasFuncOnUpdated returns true if the function "WEBEXT.tabGroups.onUpdated.addListener" exists. 960 func HasFuncOnUpdated() bool { 961 return js.True == bindings.HasFuncOnUpdated() 962 } 963 964 // FuncOnUpdated returns the function "WEBEXT.tabGroups.onUpdated.addListener". 965 func FuncOnUpdated() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 966 bindings.FuncOnUpdated( 967 js.Pointer(&fn), 968 ) 969 return 970 } 971 972 // OnUpdated calls the function "WEBEXT.tabGroups.onUpdated.addListener" directly. 973 func OnUpdated(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 974 bindings.CallOnUpdated( 975 js.Pointer(&ret), 976 callback.Ref(), 977 ) 978 979 return 980 } 981 982 // TryOnUpdated calls the function "WEBEXT.tabGroups.onUpdated.addListener" 983 // in a try/catch block and returns (_, err, ok = false) when it went through 984 // the catch clause. 985 func TryOnUpdated(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 986 ok = js.True == bindings.TryOnUpdated( 987 js.Pointer(&ret), js.Pointer(&exception), 988 callback.Ref(), 989 ) 990 991 return 992 } 993 994 // HasFuncOffUpdated returns true if the function "WEBEXT.tabGroups.onUpdated.removeListener" exists. 995 func HasFuncOffUpdated() bool { 996 return js.True == bindings.HasFuncOffUpdated() 997 } 998 999 // FuncOffUpdated returns the function "WEBEXT.tabGroups.onUpdated.removeListener". 1000 func FuncOffUpdated() (fn js.Func[func(callback js.Func[func(group *TabGroup)])]) { 1001 bindings.FuncOffUpdated( 1002 js.Pointer(&fn), 1003 ) 1004 return 1005 } 1006 1007 // OffUpdated calls the function "WEBEXT.tabGroups.onUpdated.removeListener" directly. 1008 func OffUpdated(callback js.Func[func(group *TabGroup)]) (ret js.Void) { 1009 bindings.CallOffUpdated( 1010 js.Pointer(&ret), 1011 callback.Ref(), 1012 ) 1013 1014 return 1015 } 1016 1017 // TryOffUpdated calls the function "WEBEXT.tabGroups.onUpdated.removeListener" 1018 // in a try/catch block and returns (_, err, ok = false) when it went through 1019 // the catch clause. 1020 func TryOffUpdated(callback js.Func[func(group *TabGroup)]) (ret js.Void, exception js.Any, ok bool) { 1021 ok = js.True == bindings.TryOffUpdated( 1022 js.Pointer(&ret), js.Pointer(&exception), 1023 callback.Ref(), 1024 ) 1025 1026 return 1027 } 1028 1029 // HasFuncHasOnUpdated returns true if the function "WEBEXT.tabGroups.onUpdated.hasListener" exists. 1030 func HasFuncHasOnUpdated() bool { 1031 return js.True == bindings.HasFuncHasOnUpdated() 1032 } 1033 1034 // FuncHasOnUpdated returns the function "WEBEXT.tabGroups.onUpdated.hasListener". 1035 func FuncHasOnUpdated() (fn js.Func[func(callback js.Func[func(group *TabGroup)]) bool]) { 1036 bindings.FuncHasOnUpdated( 1037 js.Pointer(&fn), 1038 ) 1039 return 1040 } 1041 1042 // HasOnUpdated calls the function "WEBEXT.tabGroups.onUpdated.hasListener" directly. 1043 func HasOnUpdated(callback js.Func[func(group *TabGroup)]) (ret bool) { 1044 bindings.CallHasOnUpdated( 1045 js.Pointer(&ret), 1046 callback.Ref(), 1047 ) 1048 1049 return 1050 } 1051 1052 // TryHasOnUpdated calls the function "WEBEXT.tabGroups.onUpdated.hasListener" 1053 // in a try/catch block and returns (_, err, ok = false) when it went through 1054 // the catch clause. 1055 func TryHasOnUpdated(callback js.Func[func(group *TabGroup)]) (ret bool, exception js.Any, ok bool) { 1056 ok = js.True == bindings.TryHasOnUpdated( 1057 js.Pointer(&ret), js.Pointer(&exception), 1058 callback.Ref(), 1059 ) 1060 1061 return 1062 } 1063 1064 // HasFuncQuery returns true if the function "WEBEXT.tabGroups.query" exists. 1065 func HasFuncQuery() bool { 1066 return js.True == bindings.HasFuncQuery() 1067 } 1068 1069 // FuncQuery returns the function "WEBEXT.tabGroups.query". 1070 func FuncQuery() (fn js.Func[func(queryInfo QueryArgQueryInfo) js.Promise[js.Array[TabGroup]]]) { 1071 bindings.FuncQuery( 1072 js.Pointer(&fn), 1073 ) 1074 return 1075 } 1076 1077 // Query calls the function "WEBEXT.tabGroups.query" directly. 1078 func Query(queryInfo QueryArgQueryInfo) (ret js.Promise[js.Array[TabGroup]]) { 1079 bindings.CallQuery( 1080 js.Pointer(&ret), 1081 js.Pointer(&queryInfo), 1082 ) 1083 1084 return 1085 } 1086 1087 // TryQuery calls the function "WEBEXT.tabGroups.query" 1088 // in a try/catch block and returns (_, err, ok = false) when it went through 1089 // the catch clause. 1090 func TryQuery(queryInfo QueryArgQueryInfo) (ret js.Promise[js.Array[TabGroup]], exception js.Any, ok bool) { 1091 ok = js.True == bindings.TryQuery( 1092 js.Pointer(&ret), js.Pointer(&exception), 1093 js.Pointer(&queryInfo), 1094 ) 1095 1096 return 1097 } 1098 1099 // HasFuncUpdate returns true if the function "WEBEXT.tabGroups.update" exists. 1100 func HasFuncUpdate() bool { 1101 return js.True == bindings.HasFuncUpdate() 1102 } 1103 1104 // FuncUpdate returns the function "WEBEXT.tabGroups.update". 1105 func FuncUpdate() (fn js.Func[func(groupId int64, updateProperties UpdateArgUpdateProperties) js.Promise[TabGroup]]) { 1106 bindings.FuncUpdate( 1107 js.Pointer(&fn), 1108 ) 1109 return 1110 } 1111 1112 // Update calls the function "WEBEXT.tabGroups.update" directly. 1113 func Update(groupId int64, updateProperties UpdateArgUpdateProperties) (ret js.Promise[TabGroup]) { 1114 bindings.CallUpdate( 1115 js.Pointer(&ret), 1116 float64(groupId), 1117 js.Pointer(&updateProperties), 1118 ) 1119 1120 return 1121 } 1122 1123 // TryUpdate calls the function "WEBEXT.tabGroups.update" 1124 // in a try/catch block and returns (_, err, ok = false) when it went through 1125 // the catch clause. 1126 func TryUpdate(groupId int64, updateProperties UpdateArgUpdateProperties) (ret js.Promise[TabGroup], exception js.Any, ok bool) { 1127 ok = js.True == bindings.TryUpdate( 1128 js.Pointer(&ret), js.Pointer(&exception), 1129 float64(groupId), 1130 js.Pointer(&updateProperties), 1131 ) 1132 1133 return 1134 }