github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/windows/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package windows 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/tabs" 11 "github.com/primecitizens/pcz/std/plat/js/webext/windows/bindings" 12 ) 13 14 type WindowState uint32 15 16 const ( 17 _ WindowState = iota 18 19 WindowState_NORMAL 20 WindowState_MINIMIZED 21 WindowState_MAXIMIZED 22 WindowState_FULLSCREEN 23 WindowState_LOCKED_FULLSCREEN 24 ) 25 26 func (WindowState) FromRef(str js.Ref) WindowState { 27 return WindowState(bindings.ConstOfWindowState(str)) 28 } 29 30 func (x WindowState) String() (string, bool) { 31 switch x { 32 case WindowState_NORMAL: 33 return "normal", true 34 case WindowState_MINIMIZED: 35 return "minimized", true 36 case WindowState_MAXIMIZED: 37 return "maximized", true 38 case WindowState_FULLSCREEN: 39 return "fullscreen", true 40 case WindowState_LOCKED_FULLSCREEN: 41 return "locked-fullscreen", true 42 default: 43 return "", false 44 } 45 } 46 47 type CreateType uint32 48 49 const ( 50 _ CreateType = iota 51 52 CreateType_NORMAL 53 CreateType_POPUP 54 CreateType_PANEL 55 ) 56 57 func (CreateType) FromRef(str js.Ref) CreateType { 58 return CreateType(bindings.ConstOfCreateType(str)) 59 } 60 61 func (x CreateType) String() (string, bool) { 62 switch x { 63 case CreateType_NORMAL: 64 return "normal", true 65 case CreateType_POPUP: 66 return "popup", true 67 case CreateType_PANEL: 68 return "panel", true 69 default: 70 return "", false 71 } 72 } 73 74 type OneOf_String_ArrayString struct { 75 ref js.Ref 76 } 77 78 func (x OneOf_String_ArrayString) Ref() js.Ref { 79 return x.ref 80 } 81 82 func (x OneOf_String_ArrayString) Free() { 83 x.ref.Free() 84 } 85 86 func (x OneOf_String_ArrayString) FromRef(ref js.Ref) OneOf_String_ArrayString { 87 return OneOf_String_ArrayString{ 88 ref: ref, 89 } 90 } 91 92 func (x OneOf_String_ArrayString) String() js.String { 93 return js.String{}.FromRef(x.ref) 94 } 95 96 func (x OneOf_String_ArrayString) ArrayString() js.Array[js.String] { 97 return js.Array[js.String]{}.FromRef(x.ref) 98 } 99 100 type CreateArgCreateData struct { 101 // Focused is "CreateArgCreateData.focused" 102 // 103 // Optional 104 // 105 // NOTE: FFI_USE_Focused MUST be set to true to make this field effective. 106 Focused bool 107 // Height is "CreateArgCreateData.height" 108 // 109 // Optional 110 // 111 // NOTE: FFI_USE_Height MUST be set to true to make this field effective. 112 Height int64 113 // Incognito is "CreateArgCreateData.incognito" 114 // 115 // Optional 116 // 117 // NOTE: FFI_USE_Incognito MUST be set to true to make this field effective. 118 Incognito bool 119 // Left is "CreateArgCreateData.left" 120 // 121 // Optional 122 // 123 // NOTE: FFI_USE_Left MUST be set to true to make this field effective. 124 Left int64 125 // SetSelfAsOpener is "CreateArgCreateData.setSelfAsOpener" 126 // 127 // Optional 128 // 129 // NOTE: FFI_USE_SetSelfAsOpener MUST be set to true to make this field effective. 130 SetSelfAsOpener bool 131 // State is "CreateArgCreateData.state" 132 // 133 // Optional 134 State WindowState 135 // TabId is "CreateArgCreateData.tabId" 136 // 137 // Optional 138 // 139 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 140 TabId int64 141 // Top is "CreateArgCreateData.top" 142 // 143 // Optional 144 // 145 // NOTE: FFI_USE_Top MUST be set to true to make this field effective. 146 Top int64 147 // Type is "CreateArgCreateData.type" 148 // 149 // Optional 150 Type CreateType 151 // Url is "CreateArgCreateData.url" 152 // 153 // Optional 154 Url OneOf_String_ArrayString 155 // Width is "CreateArgCreateData.width" 156 // 157 // Optional 158 // 159 // NOTE: FFI_USE_Width MUST be set to true to make this field effective. 160 Width int64 161 162 FFI_USE_Focused bool // for Focused. 163 FFI_USE_Height bool // for Height. 164 FFI_USE_Incognito bool // for Incognito. 165 FFI_USE_Left bool // for Left. 166 FFI_USE_SetSelfAsOpener bool // for SetSelfAsOpener. 167 FFI_USE_TabId bool // for TabId. 168 FFI_USE_Top bool // for Top. 169 FFI_USE_Width bool // for Width. 170 171 FFI_USE bool 172 } 173 174 // FromRef calls UpdateFrom and returns a CreateArgCreateData with all fields set. 175 func (p CreateArgCreateData) FromRef(ref js.Ref) CreateArgCreateData { 176 p.UpdateFrom(ref) 177 return p 178 } 179 180 // New creates a new CreateArgCreateData in the application heap. 181 func (p CreateArgCreateData) New() js.Ref { 182 return bindings.CreateArgCreateDataJSLoad( 183 js.Pointer(&p), js.True, 0, 184 ) 185 } 186 187 // UpdateFrom copies value of all fields of the heap object to p. 188 func (p *CreateArgCreateData) UpdateFrom(ref js.Ref) { 189 bindings.CreateArgCreateDataJSStore( 190 js.Pointer(p), ref, 191 ) 192 } 193 194 // Update writes all fields of the p to the heap object referenced by ref. 195 func (p *CreateArgCreateData) Update(ref js.Ref) { 196 bindings.CreateArgCreateDataJSLoad( 197 js.Pointer(p), js.False, ref, 198 ) 199 } 200 201 // FreeMembers frees fields with heap reference, if recursive is true 202 // free all heap references reachable from p. 203 func (p *CreateArgCreateData) FreeMembers(recursive bool) { 204 js.Free( 205 p.Url.Ref(), 206 ) 207 p.Url = p.Url.FromRef(js.Undefined) 208 } 209 210 type WindowType uint32 211 212 const ( 213 _ WindowType = iota 214 215 WindowType_NORMAL 216 WindowType_POPUP 217 WindowType_PANEL 218 WindowType_APP 219 WindowType_DEVTOOLS 220 ) 221 222 func (WindowType) FromRef(str js.Ref) WindowType { 223 return WindowType(bindings.ConstOfWindowType(str)) 224 } 225 226 func (x WindowType) String() (string, bool) { 227 switch x { 228 case WindowType_NORMAL: 229 return "normal", true 230 case WindowType_POPUP: 231 return "popup", true 232 case WindowType_PANEL: 233 return "panel", true 234 case WindowType_APP: 235 return "app", true 236 case WindowType_DEVTOOLS: 237 return "devtools", true 238 default: 239 return "", false 240 } 241 } 242 243 type Window struct { 244 // AlwaysOnTop is "Window.alwaysOnTop" 245 // 246 // Required 247 AlwaysOnTop bool 248 // Focused is "Window.focused" 249 // 250 // Required 251 Focused bool 252 // Height is "Window.height" 253 // 254 // Optional 255 // 256 // NOTE: FFI_USE_Height MUST be set to true to make this field effective. 257 Height int64 258 // Id is "Window.id" 259 // 260 // Optional 261 // 262 // NOTE: FFI_USE_Id MUST be set to true to make this field effective. 263 Id int64 264 // Incognito is "Window.incognito" 265 // 266 // Required 267 Incognito bool 268 // Left is "Window.left" 269 // 270 // Optional 271 // 272 // NOTE: FFI_USE_Left MUST be set to true to make this field effective. 273 Left int64 274 // SessionId is "Window.sessionId" 275 // 276 // Optional 277 SessionId js.String 278 // State is "Window.state" 279 // 280 // Optional 281 State WindowState 282 // Tabs is "Window.tabs" 283 // 284 // Optional 285 Tabs js.Array[tabs.Tab] 286 // Top is "Window.top" 287 // 288 // Optional 289 // 290 // NOTE: FFI_USE_Top MUST be set to true to make this field effective. 291 Top int64 292 // Type is "Window.type" 293 // 294 // Optional 295 Type WindowType 296 // Width is "Window.width" 297 // 298 // Optional 299 // 300 // NOTE: FFI_USE_Width MUST be set to true to make this field effective. 301 Width int64 302 303 FFI_USE_Height bool // for Height. 304 FFI_USE_Id bool // for Id. 305 FFI_USE_Left bool // for Left. 306 FFI_USE_Top bool // for Top. 307 FFI_USE_Width bool // for Width. 308 309 FFI_USE bool 310 } 311 312 // FromRef calls UpdateFrom and returns a Window with all fields set. 313 func (p Window) FromRef(ref js.Ref) Window { 314 p.UpdateFrom(ref) 315 return p 316 } 317 318 // New creates a new Window in the application heap. 319 func (p Window) New() js.Ref { 320 return bindings.WindowJSLoad( 321 js.Pointer(&p), js.True, 0, 322 ) 323 } 324 325 // UpdateFrom copies value of all fields of the heap object to p. 326 func (p *Window) UpdateFrom(ref js.Ref) { 327 bindings.WindowJSStore( 328 js.Pointer(p), ref, 329 ) 330 } 331 332 // Update writes all fields of the p to the heap object referenced by ref. 333 func (p *Window) Update(ref js.Ref) { 334 bindings.WindowJSLoad( 335 js.Pointer(p), js.False, ref, 336 ) 337 } 338 339 // FreeMembers frees fields with heap reference, if recursive is true 340 // free all heap references reachable from p. 341 func (p *Window) FreeMembers(recursive bool) { 342 js.Free( 343 p.SessionId.Ref(), 344 p.Tabs.Ref(), 345 ) 346 p.SessionId = p.SessionId.FromRef(js.Undefined) 347 p.Tabs = p.Tabs.FromRef(js.Undefined) 348 } 349 350 type QueryOptions struct { 351 // Populate is "QueryOptions.populate" 352 // 353 // Optional 354 // 355 // NOTE: FFI_USE_Populate MUST be set to true to make this field effective. 356 Populate bool 357 // WindowTypes is "QueryOptions.windowTypes" 358 // 359 // Optional 360 WindowTypes js.Array[WindowType] 361 362 FFI_USE_Populate bool // for Populate. 363 364 FFI_USE bool 365 } 366 367 // FromRef calls UpdateFrom and returns a QueryOptions with all fields set. 368 func (p QueryOptions) FromRef(ref js.Ref) QueryOptions { 369 p.UpdateFrom(ref) 370 return p 371 } 372 373 // New creates a new QueryOptions in the application heap. 374 func (p QueryOptions) New() js.Ref { 375 return bindings.QueryOptionsJSLoad( 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 *QueryOptions) UpdateFrom(ref js.Ref) { 382 bindings.QueryOptionsJSStore( 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 *QueryOptions) Update(ref js.Ref) { 389 bindings.QueryOptionsJSLoad( 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 *QueryOptions) FreeMembers(recursive bool) { 397 js.Free( 398 p.WindowTypes.Ref(), 399 ) 400 p.WindowTypes = p.WindowTypes.FromRef(js.Undefined) 401 } 402 403 type UpdateArgUpdateInfo struct { 404 // DrawAttention is "UpdateArgUpdateInfo.drawAttention" 405 // 406 // Optional 407 // 408 // NOTE: FFI_USE_DrawAttention MUST be set to true to make this field effective. 409 DrawAttention bool 410 // Focused is "UpdateArgUpdateInfo.focused" 411 // 412 // Optional 413 // 414 // NOTE: FFI_USE_Focused MUST be set to true to make this field effective. 415 Focused bool 416 // Height is "UpdateArgUpdateInfo.height" 417 // 418 // Optional 419 // 420 // NOTE: FFI_USE_Height MUST be set to true to make this field effective. 421 Height int64 422 // Left is "UpdateArgUpdateInfo.left" 423 // 424 // Optional 425 // 426 // NOTE: FFI_USE_Left MUST be set to true to make this field effective. 427 Left int64 428 // State is "UpdateArgUpdateInfo.state" 429 // 430 // Optional 431 State WindowState 432 // Top is "UpdateArgUpdateInfo.top" 433 // 434 // Optional 435 // 436 // NOTE: FFI_USE_Top MUST be set to true to make this field effective. 437 Top int64 438 // Width is "UpdateArgUpdateInfo.width" 439 // 440 // Optional 441 // 442 // NOTE: FFI_USE_Width MUST be set to true to make this field effective. 443 Width int64 444 445 FFI_USE_DrawAttention bool // for DrawAttention. 446 FFI_USE_Focused bool // for Focused. 447 FFI_USE_Height bool // for Height. 448 FFI_USE_Left bool // for Left. 449 FFI_USE_Top bool // for Top. 450 FFI_USE_Width bool // for Width. 451 452 FFI_USE bool 453 } 454 455 // FromRef calls UpdateFrom and returns a UpdateArgUpdateInfo with all fields set. 456 func (p UpdateArgUpdateInfo) FromRef(ref js.Ref) UpdateArgUpdateInfo { 457 p.UpdateFrom(ref) 458 return p 459 } 460 461 // New creates a new UpdateArgUpdateInfo in the application heap. 462 func (p UpdateArgUpdateInfo) New() js.Ref { 463 return bindings.UpdateArgUpdateInfoJSLoad( 464 js.Pointer(&p), js.True, 0, 465 ) 466 } 467 468 // UpdateFrom copies value of all fields of the heap object to p. 469 func (p *UpdateArgUpdateInfo) UpdateFrom(ref js.Ref) { 470 bindings.UpdateArgUpdateInfoJSStore( 471 js.Pointer(p), ref, 472 ) 473 } 474 475 // Update writes all fields of the p to the heap object referenced by ref. 476 func (p *UpdateArgUpdateInfo) Update(ref js.Ref) { 477 bindings.UpdateArgUpdateInfoJSLoad( 478 js.Pointer(p), js.False, ref, 479 ) 480 } 481 482 // FreeMembers frees fields with heap reference, if recursive is true 483 // free all heap references reachable from p. 484 func (p *UpdateArgUpdateInfo) FreeMembers(recursive bool) { 485 } 486 487 // WINDOW_ID_CURRENT returns the value of property "WEBEXT.windows.WINDOW_ID_CURRENT". 488 // 489 // The returned bool will be false if there is no such property. 490 func WINDOW_ID_CURRENT() (ret js.String, ok bool) { 491 ok = js.True == bindings.GetWINDOW_ID_CURRENT( 492 js.Pointer(&ret), 493 ) 494 495 return 496 } 497 498 // SetWINDOW_ID_CURRENT sets the value of property "WEBEXT.windows.WINDOW_ID_CURRENT" to val. 499 // 500 // It returns false if the property cannot be set. 501 func SetWINDOW_ID_CURRENT(val js.String) bool { 502 return js.True == bindings.SetWINDOW_ID_CURRENT( 503 val.Ref()) 504 } 505 506 // WINDOW_ID_NONE returns the value of property "WEBEXT.windows.WINDOW_ID_NONE". 507 // 508 // The returned bool will be false if there is no such property. 509 func WINDOW_ID_NONE() (ret js.String, ok bool) { 510 ok = js.True == bindings.GetWINDOW_ID_NONE( 511 js.Pointer(&ret), 512 ) 513 514 return 515 } 516 517 // SetWINDOW_ID_NONE sets the value of property "WEBEXT.windows.WINDOW_ID_NONE" to val. 518 // 519 // It returns false if the property cannot be set. 520 func SetWINDOW_ID_NONE(val js.String) bool { 521 return js.True == bindings.SetWINDOW_ID_NONE( 522 val.Ref()) 523 } 524 525 // HasFuncCreate returns true if the function "WEBEXT.windows.create" exists. 526 func HasFuncCreate() bool { 527 return js.True == bindings.HasFuncCreate() 528 } 529 530 // FuncCreate returns the function "WEBEXT.windows.create". 531 func FuncCreate() (fn js.Func[func(createData CreateArgCreateData) js.Promise[Window]]) { 532 bindings.FuncCreate( 533 js.Pointer(&fn), 534 ) 535 return 536 } 537 538 // Create calls the function "WEBEXT.windows.create" directly. 539 func Create(createData CreateArgCreateData) (ret js.Promise[Window]) { 540 bindings.CallCreate( 541 js.Pointer(&ret), 542 js.Pointer(&createData), 543 ) 544 545 return 546 } 547 548 // TryCreate calls the function "WEBEXT.windows.create" 549 // in a try/catch block and returns (_, err, ok = false) when it went through 550 // the catch clause. 551 func TryCreate(createData CreateArgCreateData) (ret js.Promise[Window], exception js.Any, ok bool) { 552 ok = js.True == bindings.TryCreate( 553 js.Pointer(&ret), js.Pointer(&exception), 554 js.Pointer(&createData), 555 ) 556 557 return 558 } 559 560 // HasFuncGet returns true if the function "WEBEXT.windows.get" exists. 561 func HasFuncGet() bool { 562 return js.True == bindings.HasFuncGet() 563 } 564 565 // FuncGet returns the function "WEBEXT.windows.get". 566 func FuncGet() (fn js.Func[func(windowId int64, queryOptions QueryOptions) js.Promise[Window]]) { 567 bindings.FuncGet( 568 js.Pointer(&fn), 569 ) 570 return 571 } 572 573 // Get calls the function "WEBEXT.windows.get" directly. 574 func Get(windowId int64, queryOptions QueryOptions) (ret js.Promise[Window]) { 575 bindings.CallGet( 576 js.Pointer(&ret), 577 float64(windowId), 578 js.Pointer(&queryOptions), 579 ) 580 581 return 582 } 583 584 // TryGet calls the function "WEBEXT.windows.get" 585 // in a try/catch block and returns (_, err, ok = false) when it went through 586 // the catch clause. 587 func TryGet(windowId int64, queryOptions QueryOptions) (ret js.Promise[Window], exception js.Any, ok bool) { 588 ok = js.True == bindings.TryGet( 589 js.Pointer(&ret), js.Pointer(&exception), 590 float64(windowId), 591 js.Pointer(&queryOptions), 592 ) 593 594 return 595 } 596 597 // HasFuncGetAll returns true if the function "WEBEXT.windows.getAll" exists. 598 func HasFuncGetAll() bool { 599 return js.True == bindings.HasFuncGetAll() 600 } 601 602 // FuncGetAll returns the function "WEBEXT.windows.getAll". 603 func FuncGetAll() (fn js.Func[func(queryOptions QueryOptions) js.Promise[js.Array[Window]]]) { 604 bindings.FuncGetAll( 605 js.Pointer(&fn), 606 ) 607 return 608 } 609 610 // GetAll calls the function "WEBEXT.windows.getAll" directly. 611 func GetAll(queryOptions QueryOptions) (ret js.Promise[js.Array[Window]]) { 612 bindings.CallGetAll( 613 js.Pointer(&ret), 614 js.Pointer(&queryOptions), 615 ) 616 617 return 618 } 619 620 // TryGetAll calls the function "WEBEXT.windows.getAll" 621 // in a try/catch block and returns (_, err, ok = false) when it went through 622 // the catch clause. 623 func TryGetAll(queryOptions QueryOptions) (ret js.Promise[js.Array[Window]], exception js.Any, ok bool) { 624 ok = js.True == bindings.TryGetAll( 625 js.Pointer(&ret), js.Pointer(&exception), 626 js.Pointer(&queryOptions), 627 ) 628 629 return 630 } 631 632 // HasFuncGetCurrent returns true if the function "WEBEXT.windows.getCurrent" exists. 633 func HasFuncGetCurrent() bool { 634 return js.True == bindings.HasFuncGetCurrent() 635 } 636 637 // FuncGetCurrent returns the function "WEBEXT.windows.getCurrent". 638 func FuncGetCurrent() (fn js.Func[func(queryOptions QueryOptions) js.Promise[Window]]) { 639 bindings.FuncGetCurrent( 640 js.Pointer(&fn), 641 ) 642 return 643 } 644 645 // GetCurrent calls the function "WEBEXT.windows.getCurrent" directly. 646 func GetCurrent(queryOptions QueryOptions) (ret js.Promise[Window]) { 647 bindings.CallGetCurrent( 648 js.Pointer(&ret), 649 js.Pointer(&queryOptions), 650 ) 651 652 return 653 } 654 655 // TryGetCurrent calls the function "WEBEXT.windows.getCurrent" 656 // in a try/catch block and returns (_, err, ok = false) when it went through 657 // the catch clause. 658 func TryGetCurrent(queryOptions QueryOptions) (ret js.Promise[Window], exception js.Any, ok bool) { 659 ok = js.True == bindings.TryGetCurrent( 660 js.Pointer(&ret), js.Pointer(&exception), 661 js.Pointer(&queryOptions), 662 ) 663 664 return 665 } 666 667 // HasFuncGetLastFocused returns true if the function "WEBEXT.windows.getLastFocused" exists. 668 func HasFuncGetLastFocused() bool { 669 return js.True == bindings.HasFuncGetLastFocused() 670 } 671 672 // FuncGetLastFocused returns the function "WEBEXT.windows.getLastFocused". 673 func FuncGetLastFocused() (fn js.Func[func(queryOptions QueryOptions) js.Promise[Window]]) { 674 bindings.FuncGetLastFocused( 675 js.Pointer(&fn), 676 ) 677 return 678 } 679 680 // GetLastFocused calls the function "WEBEXT.windows.getLastFocused" directly. 681 func GetLastFocused(queryOptions QueryOptions) (ret js.Promise[Window]) { 682 bindings.CallGetLastFocused( 683 js.Pointer(&ret), 684 js.Pointer(&queryOptions), 685 ) 686 687 return 688 } 689 690 // TryGetLastFocused calls the function "WEBEXT.windows.getLastFocused" 691 // in a try/catch block and returns (_, err, ok = false) when it went through 692 // the catch clause. 693 func TryGetLastFocused(queryOptions QueryOptions) (ret js.Promise[Window], exception js.Any, ok bool) { 694 ok = js.True == bindings.TryGetLastFocused( 695 js.Pointer(&ret), js.Pointer(&exception), 696 js.Pointer(&queryOptions), 697 ) 698 699 return 700 } 701 702 type OnBoundsChangedEventCallbackFunc func(this js.Ref, window *Window) js.Ref 703 704 func (fn OnBoundsChangedEventCallbackFunc) Register() js.Func[func(window *Window)] { 705 return js.RegisterCallback[func(window *Window)]( 706 fn, abi.FuncPCABIInternal(fn), 707 ) 708 } 709 710 func (fn OnBoundsChangedEventCallbackFunc) DispatchCallback( 711 targetPC uintptr, ctx *js.CallbackContext, 712 ) { 713 args := ctx.Args() 714 if len(args) != 1+1 /* js this */ || 715 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 716 js.ThrowInvalidCallbackInvocation() 717 } 718 var arg0 Window 719 arg0.UpdateFrom(args[0+1]) 720 defer arg0.FreeMembers(true) 721 722 if ctx.Return(fn( 723 args[0], 724 725 mark.NoEscape(&arg0), 726 )) { 727 return 728 } 729 730 js.ThrowCallbackValueNotReturned() 731 } 732 733 type OnBoundsChangedEventCallback[T any] struct { 734 Fn func(arg T, this js.Ref, window *Window) js.Ref 735 Arg T 736 } 737 738 func (cb *OnBoundsChangedEventCallback[T]) Register() js.Func[func(window *Window)] { 739 return js.RegisterCallback[func(window *Window)]( 740 cb, abi.FuncPCABIInternal(cb.Fn), 741 ) 742 } 743 744 func (cb *OnBoundsChangedEventCallback[T]) DispatchCallback( 745 targetPC uintptr, ctx *js.CallbackContext, 746 ) { 747 args := ctx.Args() 748 if len(args) != 1+1 /* js this */ || 749 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 750 js.ThrowInvalidCallbackInvocation() 751 } 752 var arg0 Window 753 arg0.UpdateFrom(args[0+1]) 754 defer arg0.FreeMembers(true) 755 756 if ctx.Return(cb.Fn( 757 cb.Arg, 758 args[0], 759 760 mark.NoEscape(&arg0), 761 )) { 762 return 763 } 764 765 js.ThrowCallbackValueNotReturned() 766 } 767 768 // HasFuncOnBoundsChanged returns true if the function "WEBEXT.windows.onBoundsChanged.addListener" exists. 769 func HasFuncOnBoundsChanged() bool { 770 return js.True == bindings.HasFuncOnBoundsChanged() 771 } 772 773 // FuncOnBoundsChanged returns the function "WEBEXT.windows.onBoundsChanged.addListener". 774 func FuncOnBoundsChanged() (fn js.Func[func(callback js.Func[func(window *Window)])]) { 775 bindings.FuncOnBoundsChanged( 776 js.Pointer(&fn), 777 ) 778 return 779 } 780 781 // OnBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.addListener" directly. 782 func OnBoundsChanged(callback js.Func[func(window *Window)]) (ret js.Void) { 783 bindings.CallOnBoundsChanged( 784 js.Pointer(&ret), 785 callback.Ref(), 786 ) 787 788 return 789 } 790 791 // TryOnBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.addListener" 792 // in a try/catch block and returns (_, err, ok = false) when it went through 793 // the catch clause. 794 func TryOnBoundsChanged(callback js.Func[func(window *Window)]) (ret js.Void, exception js.Any, ok bool) { 795 ok = js.True == bindings.TryOnBoundsChanged( 796 js.Pointer(&ret), js.Pointer(&exception), 797 callback.Ref(), 798 ) 799 800 return 801 } 802 803 // HasFuncOffBoundsChanged returns true if the function "WEBEXT.windows.onBoundsChanged.removeListener" exists. 804 func HasFuncOffBoundsChanged() bool { 805 return js.True == bindings.HasFuncOffBoundsChanged() 806 } 807 808 // FuncOffBoundsChanged returns the function "WEBEXT.windows.onBoundsChanged.removeListener". 809 func FuncOffBoundsChanged() (fn js.Func[func(callback js.Func[func(window *Window)])]) { 810 bindings.FuncOffBoundsChanged( 811 js.Pointer(&fn), 812 ) 813 return 814 } 815 816 // OffBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.removeListener" directly. 817 func OffBoundsChanged(callback js.Func[func(window *Window)]) (ret js.Void) { 818 bindings.CallOffBoundsChanged( 819 js.Pointer(&ret), 820 callback.Ref(), 821 ) 822 823 return 824 } 825 826 // TryOffBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.removeListener" 827 // in a try/catch block and returns (_, err, ok = false) when it went through 828 // the catch clause. 829 func TryOffBoundsChanged(callback js.Func[func(window *Window)]) (ret js.Void, exception js.Any, ok bool) { 830 ok = js.True == bindings.TryOffBoundsChanged( 831 js.Pointer(&ret), js.Pointer(&exception), 832 callback.Ref(), 833 ) 834 835 return 836 } 837 838 // HasFuncHasOnBoundsChanged returns true if the function "WEBEXT.windows.onBoundsChanged.hasListener" exists. 839 func HasFuncHasOnBoundsChanged() bool { 840 return js.True == bindings.HasFuncHasOnBoundsChanged() 841 } 842 843 // FuncHasOnBoundsChanged returns the function "WEBEXT.windows.onBoundsChanged.hasListener". 844 func FuncHasOnBoundsChanged() (fn js.Func[func(callback js.Func[func(window *Window)]) bool]) { 845 bindings.FuncHasOnBoundsChanged( 846 js.Pointer(&fn), 847 ) 848 return 849 } 850 851 // HasOnBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.hasListener" directly. 852 func HasOnBoundsChanged(callback js.Func[func(window *Window)]) (ret bool) { 853 bindings.CallHasOnBoundsChanged( 854 js.Pointer(&ret), 855 callback.Ref(), 856 ) 857 858 return 859 } 860 861 // TryHasOnBoundsChanged calls the function "WEBEXT.windows.onBoundsChanged.hasListener" 862 // in a try/catch block and returns (_, err, ok = false) when it went through 863 // the catch clause. 864 func TryHasOnBoundsChanged(callback js.Func[func(window *Window)]) (ret bool, exception js.Any, ok bool) { 865 ok = js.True == bindings.TryHasOnBoundsChanged( 866 js.Pointer(&ret), js.Pointer(&exception), 867 callback.Ref(), 868 ) 869 870 return 871 } 872 873 type OnCreatedEventCallbackFunc func(this js.Ref, window *Window) js.Ref 874 875 func (fn OnCreatedEventCallbackFunc) Register() js.Func[func(window *Window)] { 876 return js.RegisterCallback[func(window *Window)]( 877 fn, abi.FuncPCABIInternal(fn), 878 ) 879 } 880 881 func (fn OnCreatedEventCallbackFunc) DispatchCallback( 882 targetPC uintptr, ctx *js.CallbackContext, 883 ) { 884 args := ctx.Args() 885 if len(args) != 1+1 /* js this */ || 886 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 887 js.ThrowInvalidCallbackInvocation() 888 } 889 var arg0 Window 890 arg0.UpdateFrom(args[0+1]) 891 defer arg0.FreeMembers(true) 892 893 if ctx.Return(fn( 894 args[0], 895 896 mark.NoEscape(&arg0), 897 )) { 898 return 899 } 900 901 js.ThrowCallbackValueNotReturned() 902 } 903 904 type OnCreatedEventCallback[T any] struct { 905 Fn func(arg T, this js.Ref, window *Window) js.Ref 906 Arg T 907 } 908 909 func (cb *OnCreatedEventCallback[T]) Register() js.Func[func(window *Window)] { 910 return js.RegisterCallback[func(window *Window)]( 911 cb, abi.FuncPCABIInternal(cb.Fn), 912 ) 913 } 914 915 func (cb *OnCreatedEventCallback[T]) DispatchCallback( 916 targetPC uintptr, ctx *js.CallbackContext, 917 ) { 918 args := ctx.Args() 919 if len(args) != 1+1 /* js this */ || 920 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 921 js.ThrowInvalidCallbackInvocation() 922 } 923 var arg0 Window 924 arg0.UpdateFrom(args[0+1]) 925 defer arg0.FreeMembers(true) 926 927 if ctx.Return(cb.Fn( 928 cb.Arg, 929 args[0], 930 931 mark.NoEscape(&arg0), 932 )) { 933 return 934 } 935 936 js.ThrowCallbackValueNotReturned() 937 } 938 939 // HasFuncOnCreated returns true if the function "WEBEXT.windows.onCreated.addListener" exists. 940 func HasFuncOnCreated() bool { 941 return js.True == bindings.HasFuncOnCreated() 942 } 943 944 // FuncOnCreated returns the function "WEBEXT.windows.onCreated.addListener". 945 func FuncOnCreated() (fn js.Func[func(callback js.Func[func(window *Window)])]) { 946 bindings.FuncOnCreated( 947 js.Pointer(&fn), 948 ) 949 return 950 } 951 952 // OnCreated calls the function "WEBEXT.windows.onCreated.addListener" directly. 953 func OnCreated(callback js.Func[func(window *Window)]) (ret js.Void) { 954 bindings.CallOnCreated( 955 js.Pointer(&ret), 956 callback.Ref(), 957 ) 958 959 return 960 } 961 962 // TryOnCreated calls the function "WEBEXT.windows.onCreated.addListener" 963 // in a try/catch block and returns (_, err, ok = false) when it went through 964 // the catch clause. 965 func TryOnCreated(callback js.Func[func(window *Window)]) (ret js.Void, exception js.Any, ok bool) { 966 ok = js.True == bindings.TryOnCreated( 967 js.Pointer(&ret), js.Pointer(&exception), 968 callback.Ref(), 969 ) 970 971 return 972 } 973 974 // HasFuncOffCreated returns true if the function "WEBEXT.windows.onCreated.removeListener" exists. 975 func HasFuncOffCreated() bool { 976 return js.True == bindings.HasFuncOffCreated() 977 } 978 979 // FuncOffCreated returns the function "WEBEXT.windows.onCreated.removeListener". 980 func FuncOffCreated() (fn js.Func[func(callback js.Func[func(window *Window)])]) { 981 bindings.FuncOffCreated( 982 js.Pointer(&fn), 983 ) 984 return 985 } 986 987 // OffCreated calls the function "WEBEXT.windows.onCreated.removeListener" directly. 988 func OffCreated(callback js.Func[func(window *Window)]) (ret js.Void) { 989 bindings.CallOffCreated( 990 js.Pointer(&ret), 991 callback.Ref(), 992 ) 993 994 return 995 } 996 997 // TryOffCreated calls the function "WEBEXT.windows.onCreated.removeListener" 998 // in a try/catch block and returns (_, err, ok = false) when it went through 999 // the catch clause. 1000 func TryOffCreated(callback js.Func[func(window *Window)]) (ret js.Void, exception js.Any, ok bool) { 1001 ok = js.True == bindings.TryOffCreated( 1002 js.Pointer(&ret), js.Pointer(&exception), 1003 callback.Ref(), 1004 ) 1005 1006 return 1007 } 1008 1009 // HasFuncHasOnCreated returns true if the function "WEBEXT.windows.onCreated.hasListener" exists. 1010 func HasFuncHasOnCreated() bool { 1011 return js.True == bindings.HasFuncHasOnCreated() 1012 } 1013 1014 // FuncHasOnCreated returns the function "WEBEXT.windows.onCreated.hasListener". 1015 func FuncHasOnCreated() (fn js.Func[func(callback js.Func[func(window *Window)]) bool]) { 1016 bindings.FuncHasOnCreated( 1017 js.Pointer(&fn), 1018 ) 1019 return 1020 } 1021 1022 // HasOnCreated calls the function "WEBEXT.windows.onCreated.hasListener" directly. 1023 func HasOnCreated(callback js.Func[func(window *Window)]) (ret bool) { 1024 bindings.CallHasOnCreated( 1025 js.Pointer(&ret), 1026 callback.Ref(), 1027 ) 1028 1029 return 1030 } 1031 1032 // TryHasOnCreated calls the function "WEBEXT.windows.onCreated.hasListener" 1033 // in a try/catch block and returns (_, err, ok = false) when it went through 1034 // the catch clause. 1035 func TryHasOnCreated(callback js.Func[func(window *Window)]) (ret bool, exception js.Any, ok bool) { 1036 ok = js.True == bindings.TryHasOnCreated( 1037 js.Pointer(&ret), js.Pointer(&exception), 1038 callback.Ref(), 1039 ) 1040 1041 return 1042 } 1043 1044 type OnFocusChangedEventCallbackFunc func(this js.Ref, windowId int64) js.Ref 1045 1046 func (fn OnFocusChangedEventCallbackFunc) Register() js.Func[func(windowId int64)] { 1047 return js.RegisterCallback[func(windowId int64)]( 1048 fn, abi.FuncPCABIInternal(fn), 1049 ) 1050 } 1051 1052 func (fn OnFocusChangedEventCallbackFunc) DispatchCallback( 1053 targetPC uintptr, ctx *js.CallbackContext, 1054 ) { 1055 args := ctx.Args() 1056 if len(args) != 1+1 /* js this */ || 1057 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1058 js.ThrowInvalidCallbackInvocation() 1059 } 1060 1061 if ctx.Return(fn( 1062 args[0], 1063 1064 js.BigInt[int64]{}.FromRef(args[0+1]).Get(), 1065 )) { 1066 return 1067 } 1068 1069 js.ThrowCallbackValueNotReturned() 1070 } 1071 1072 type OnFocusChangedEventCallback[T any] struct { 1073 Fn func(arg T, this js.Ref, windowId int64) js.Ref 1074 Arg T 1075 } 1076 1077 func (cb *OnFocusChangedEventCallback[T]) Register() js.Func[func(windowId int64)] { 1078 return js.RegisterCallback[func(windowId int64)]( 1079 cb, abi.FuncPCABIInternal(cb.Fn), 1080 ) 1081 } 1082 1083 func (cb *OnFocusChangedEventCallback[T]) DispatchCallback( 1084 targetPC uintptr, ctx *js.CallbackContext, 1085 ) { 1086 args := ctx.Args() 1087 if len(args) != 1+1 /* js this */ || 1088 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1089 js.ThrowInvalidCallbackInvocation() 1090 } 1091 1092 if ctx.Return(cb.Fn( 1093 cb.Arg, 1094 args[0], 1095 1096 js.BigInt[int64]{}.FromRef(args[0+1]).Get(), 1097 )) { 1098 return 1099 } 1100 1101 js.ThrowCallbackValueNotReturned() 1102 } 1103 1104 // HasFuncOnFocusChanged returns true if the function "WEBEXT.windows.onFocusChanged.addListener" exists. 1105 func HasFuncOnFocusChanged() bool { 1106 return js.True == bindings.HasFuncOnFocusChanged() 1107 } 1108 1109 // FuncOnFocusChanged returns the function "WEBEXT.windows.onFocusChanged.addListener". 1110 func FuncOnFocusChanged() (fn js.Func[func(callback js.Func[func(windowId int64)])]) { 1111 bindings.FuncOnFocusChanged( 1112 js.Pointer(&fn), 1113 ) 1114 return 1115 } 1116 1117 // OnFocusChanged calls the function "WEBEXT.windows.onFocusChanged.addListener" directly. 1118 func OnFocusChanged(callback js.Func[func(windowId int64)]) (ret js.Void) { 1119 bindings.CallOnFocusChanged( 1120 js.Pointer(&ret), 1121 callback.Ref(), 1122 ) 1123 1124 return 1125 } 1126 1127 // TryOnFocusChanged calls the function "WEBEXT.windows.onFocusChanged.addListener" 1128 // in a try/catch block and returns (_, err, ok = false) when it went through 1129 // the catch clause. 1130 func TryOnFocusChanged(callback js.Func[func(windowId int64)]) (ret js.Void, exception js.Any, ok bool) { 1131 ok = js.True == bindings.TryOnFocusChanged( 1132 js.Pointer(&ret), js.Pointer(&exception), 1133 callback.Ref(), 1134 ) 1135 1136 return 1137 } 1138 1139 // HasFuncOffFocusChanged returns true if the function "WEBEXT.windows.onFocusChanged.removeListener" exists. 1140 func HasFuncOffFocusChanged() bool { 1141 return js.True == bindings.HasFuncOffFocusChanged() 1142 } 1143 1144 // FuncOffFocusChanged returns the function "WEBEXT.windows.onFocusChanged.removeListener". 1145 func FuncOffFocusChanged() (fn js.Func[func(callback js.Func[func(windowId int64)])]) { 1146 bindings.FuncOffFocusChanged( 1147 js.Pointer(&fn), 1148 ) 1149 return 1150 } 1151 1152 // OffFocusChanged calls the function "WEBEXT.windows.onFocusChanged.removeListener" directly. 1153 func OffFocusChanged(callback js.Func[func(windowId int64)]) (ret js.Void) { 1154 bindings.CallOffFocusChanged( 1155 js.Pointer(&ret), 1156 callback.Ref(), 1157 ) 1158 1159 return 1160 } 1161 1162 // TryOffFocusChanged calls the function "WEBEXT.windows.onFocusChanged.removeListener" 1163 // in a try/catch block and returns (_, err, ok = false) when it went through 1164 // the catch clause. 1165 func TryOffFocusChanged(callback js.Func[func(windowId int64)]) (ret js.Void, exception js.Any, ok bool) { 1166 ok = js.True == bindings.TryOffFocusChanged( 1167 js.Pointer(&ret), js.Pointer(&exception), 1168 callback.Ref(), 1169 ) 1170 1171 return 1172 } 1173 1174 // HasFuncHasOnFocusChanged returns true if the function "WEBEXT.windows.onFocusChanged.hasListener" exists. 1175 func HasFuncHasOnFocusChanged() bool { 1176 return js.True == bindings.HasFuncHasOnFocusChanged() 1177 } 1178 1179 // FuncHasOnFocusChanged returns the function "WEBEXT.windows.onFocusChanged.hasListener". 1180 func FuncHasOnFocusChanged() (fn js.Func[func(callback js.Func[func(windowId int64)]) bool]) { 1181 bindings.FuncHasOnFocusChanged( 1182 js.Pointer(&fn), 1183 ) 1184 return 1185 } 1186 1187 // HasOnFocusChanged calls the function "WEBEXT.windows.onFocusChanged.hasListener" directly. 1188 func HasOnFocusChanged(callback js.Func[func(windowId int64)]) (ret bool) { 1189 bindings.CallHasOnFocusChanged( 1190 js.Pointer(&ret), 1191 callback.Ref(), 1192 ) 1193 1194 return 1195 } 1196 1197 // TryHasOnFocusChanged calls the function "WEBEXT.windows.onFocusChanged.hasListener" 1198 // in a try/catch block and returns (_, err, ok = false) when it went through 1199 // the catch clause. 1200 func TryHasOnFocusChanged(callback js.Func[func(windowId int64)]) (ret bool, exception js.Any, ok bool) { 1201 ok = js.True == bindings.TryHasOnFocusChanged( 1202 js.Pointer(&ret), js.Pointer(&exception), 1203 callback.Ref(), 1204 ) 1205 1206 return 1207 } 1208 1209 type OnRemovedEventCallbackFunc func(this js.Ref, windowId int64) js.Ref 1210 1211 func (fn OnRemovedEventCallbackFunc) Register() js.Func[func(windowId int64)] { 1212 return js.RegisterCallback[func(windowId int64)]( 1213 fn, abi.FuncPCABIInternal(fn), 1214 ) 1215 } 1216 1217 func (fn OnRemovedEventCallbackFunc) DispatchCallback( 1218 targetPC uintptr, ctx *js.CallbackContext, 1219 ) { 1220 args := ctx.Args() 1221 if len(args) != 1+1 /* js this */ || 1222 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1223 js.ThrowInvalidCallbackInvocation() 1224 } 1225 1226 if ctx.Return(fn( 1227 args[0], 1228 1229 js.BigInt[int64]{}.FromRef(args[0+1]).Get(), 1230 )) { 1231 return 1232 } 1233 1234 js.ThrowCallbackValueNotReturned() 1235 } 1236 1237 type OnRemovedEventCallback[T any] struct { 1238 Fn func(arg T, this js.Ref, windowId int64) js.Ref 1239 Arg T 1240 } 1241 1242 func (cb *OnRemovedEventCallback[T]) Register() js.Func[func(windowId int64)] { 1243 return js.RegisterCallback[func(windowId int64)]( 1244 cb, abi.FuncPCABIInternal(cb.Fn), 1245 ) 1246 } 1247 1248 func (cb *OnRemovedEventCallback[T]) DispatchCallback( 1249 targetPC uintptr, ctx *js.CallbackContext, 1250 ) { 1251 args := ctx.Args() 1252 if len(args) != 1+1 /* js this */ || 1253 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1254 js.ThrowInvalidCallbackInvocation() 1255 } 1256 1257 if ctx.Return(cb.Fn( 1258 cb.Arg, 1259 args[0], 1260 1261 js.BigInt[int64]{}.FromRef(args[0+1]).Get(), 1262 )) { 1263 return 1264 } 1265 1266 js.ThrowCallbackValueNotReturned() 1267 } 1268 1269 // HasFuncOnRemoved returns true if the function "WEBEXT.windows.onRemoved.addListener" exists. 1270 func HasFuncOnRemoved() bool { 1271 return js.True == bindings.HasFuncOnRemoved() 1272 } 1273 1274 // FuncOnRemoved returns the function "WEBEXT.windows.onRemoved.addListener". 1275 func FuncOnRemoved() (fn js.Func[func(callback js.Func[func(windowId int64)])]) { 1276 bindings.FuncOnRemoved( 1277 js.Pointer(&fn), 1278 ) 1279 return 1280 } 1281 1282 // OnRemoved calls the function "WEBEXT.windows.onRemoved.addListener" directly. 1283 func OnRemoved(callback js.Func[func(windowId int64)]) (ret js.Void) { 1284 bindings.CallOnRemoved( 1285 js.Pointer(&ret), 1286 callback.Ref(), 1287 ) 1288 1289 return 1290 } 1291 1292 // TryOnRemoved calls the function "WEBEXT.windows.onRemoved.addListener" 1293 // in a try/catch block and returns (_, err, ok = false) when it went through 1294 // the catch clause. 1295 func TryOnRemoved(callback js.Func[func(windowId int64)]) (ret js.Void, exception js.Any, ok bool) { 1296 ok = js.True == bindings.TryOnRemoved( 1297 js.Pointer(&ret), js.Pointer(&exception), 1298 callback.Ref(), 1299 ) 1300 1301 return 1302 } 1303 1304 // HasFuncOffRemoved returns true if the function "WEBEXT.windows.onRemoved.removeListener" exists. 1305 func HasFuncOffRemoved() bool { 1306 return js.True == bindings.HasFuncOffRemoved() 1307 } 1308 1309 // FuncOffRemoved returns the function "WEBEXT.windows.onRemoved.removeListener". 1310 func FuncOffRemoved() (fn js.Func[func(callback js.Func[func(windowId int64)])]) { 1311 bindings.FuncOffRemoved( 1312 js.Pointer(&fn), 1313 ) 1314 return 1315 } 1316 1317 // OffRemoved calls the function "WEBEXT.windows.onRemoved.removeListener" directly. 1318 func OffRemoved(callback js.Func[func(windowId int64)]) (ret js.Void) { 1319 bindings.CallOffRemoved( 1320 js.Pointer(&ret), 1321 callback.Ref(), 1322 ) 1323 1324 return 1325 } 1326 1327 // TryOffRemoved calls the function "WEBEXT.windows.onRemoved.removeListener" 1328 // in a try/catch block and returns (_, err, ok = false) when it went through 1329 // the catch clause. 1330 func TryOffRemoved(callback js.Func[func(windowId int64)]) (ret js.Void, exception js.Any, ok bool) { 1331 ok = js.True == bindings.TryOffRemoved( 1332 js.Pointer(&ret), js.Pointer(&exception), 1333 callback.Ref(), 1334 ) 1335 1336 return 1337 } 1338 1339 // HasFuncHasOnRemoved returns true if the function "WEBEXT.windows.onRemoved.hasListener" exists. 1340 func HasFuncHasOnRemoved() bool { 1341 return js.True == bindings.HasFuncHasOnRemoved() 1342 } 1343 1344 // FuncHasOnRemoved returns the function "WEBEXT.windows.onRemoved.hasListener". 1345 func FuncHasOnRemoved() (fn js.Func[func(callback js.Func[func(windowId int64)]) bool]) { 1346 bindings.FuncHasOnRemoved( 1347 js.Pointer(&fn), 1348 ) 1349 return 1350 } 1351 1352 // HasOnRemoved calls the function "WEBEXT.windows.onRemoved.hasListener" directly. 1353 func HasOnRemoved(callback js.Func[func(windowId int64)]) (ret bool) { 1354 bindings.CallHasOnRemoved( 1355 js.Pointer(&ret), 1356 callback.Ref(), 1357 ) 1358 1359 return 1360 } 1361 1362 // TryHasOnRemoved calls the function "WEBEXT.windows.onRemoved.hasListener" 1363 // in a try/catch block and returns (_, err, ok = false) when it went through 1364 // the catch clause. 1365 func TryHasOnRemoved(callback js.Func[func(windowId int64)]) (ret bool, exception js.Any, ok bool) { 1366 ok = js.True == bindings.TryHasOnRemoved( 1367 js.Pointer(&ret), js.Pointer(&exception), 1368 callback.Ref(), 1369 ) 1370 1371 return 1372 } 1373 1374 // HasFuncRemove returns true if the function "WEBEXT.windows.remove" exists. 1375 func HasFuncRemove() bool { 1376 return js.True == bindings.HasFuncRemove() 1377 } 1378 1379 // FuncRemove returns the function "WEBEXT.windows.remove". 1380 func FuncRemove() (fn js.Func[func(windowId int64) js.Promise[js.Void]]) { 1381 bindings.FuncRemove( 1382 js.Pointer(&fn), 1383 ) 1384 return 1385 } 1386 1387 // Remove calls the function "WEBEXT.windows.remove" directly. 1388 func Remove(windowId int64) (ret js.Promise[js.Void]) { 1389 bindings.CallRemove( 1390 js.Pointer(&ret), 1391 float64(windowId), 1392 ) 1393 1394 return 1395 } 1396 1397 // TryRemove calls the function "WEBEXT.windows.remove" 1398 // in a try/catch block and returns (_, err, ok = false) when it went through 1399 // the catch clause. 1400 func TryRemove(windowId int64) (ret js.Promise[js.Void], exception js.Any, ok bool) { 1401 ok = js.True == bindings.TryRemove( 1402 js.Pointer(&ret), js.Pointer(&exception), 1403 float64(windowId), 1404 ) 1405 1406 return 1407 } 1408 1409 // HasFuncUpdate returns true if the function "WEBEXT.windows.update" exists. 1410 func HasFuncUpdate() bool { 1411 return js.True == bindings.HasFuncUpdate() 1412 } 1413 1414 // FuncUpdate returns the function "WEBEXT.windows.update". 1415 func FuncUpdate() (fn js.Func[func(windowId int64, updateInfo UpdateArgUpdateInfo) js.Promise[Window]]) { 1416 bindings.FuncUpdate( 1417 js.Pointer(&fn), 1418 ) 1419 return 1420 } 1421 1422 // Update calls the function "WEBEXT.windows.update" directly. 1423 func Update(windowId int64, updateInfo UpdateArgUpdateInfo) (ret js.Promise[Window]) { 1424 bindings.CallUpdate( 1425 js.Pointer(&ret), 1426 float64(windowId), 1427 js.Pointer(&updateInfo), 1428 ) 1429 1430 return 1431 } 1432 1433 // TryUpdate calls the function "WEBEXT.windows.update" 1434 // in a try/catch block and returns (_, err, ok = false) when it went through 1435 // the catch clause. 1436 func TryUpdate(windowId int64, updateInfo UpdateArgUpdateInfo) (ret js.Promise[Window], exception js.Any, ok bool) { 1437 ok = js.True == bindings.TryUpdate( 1438 js.Pointer(&ret), js.Pointer(&exception), 1439 float64(windowId), 1440 js.Pointer(&updateInfo), 1441 ) 1442 1443 return 1444 }