github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/history/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package history 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/history/bindings" 11 ) 12 13 type DeleteRangeArgRange struct { 14 // EndTime is "DeleteRangeArgRange.endTime" 15 // 16 // Required 17 EndTime float64 18 // StartTime is "DeleteRangeArgRange.startTime" 19 // 20 // Required 21 StartTime float64 22 23 FFI_USE bool 24 } 25 26 // FromRef calls UpdateFrom and returns a DeleteRangeArgRange with all fields set. 27 func (p DeleteRangeArgRange) FromRef(ref js.Ref) DeleteRangeArgRange { 28 p.UpdateFrom(ref) 29 return p 30 } 31 32 // New creates a new DeleteRangeArgRange in the application heap. 33 func (p DeleteRangeArgRange) New() js.Ref { 34 return bindings.DeleteRangeArgRangeJSLoad( 35 js.Pointer(&p), js.True, 0, 36 ) 37 } 38 39 // UpdateFrom copies value of all fields of the heap object to p. 40 func (p *DeleteRangeArgRange) UpdateFrom(ref js.Ref) { 41 bindings.DeleteRangeArgRangeJSStore( 42 js.Pointer(p), ref, 43 ) 44 } 45 46 // Update writes all fields of the p to the heap object referenced by ref. 47 func (p *DeleteRangeArgRange) Update(ref js.Ref) { 48 bindings.DeleteRangeArgRangeJSLoad( 49 js.Pointer(p), js.False, ref, 50 ) 51 } 52 53 // FreeMembers frees fields with heap reference, if recursive is true 54 // free all heap references reachable from p. 55 func (p *DeleteRangeArgRange) FreeMembers(recursive bool) { 56 } 57 58 type HistoryItem struct { 59 // Id is "HistoryItem.id" 60 // 61 // Required 62 Id js.String 63 // LastVisitTime is "HistoryItem.lastVisitTime" 64 // 65 // Optional 66 // 67 // NOTE: FFI_USE_LastVisitTime MUST be set to true to make this field effective. 68 LastVisitTime float64 69 // Title is "HistoryItem.title" 70 // 71 // Optional 72 Title js.String 73 // TypedCount is "HistoryItem.typedCount" 74 // 75 // Optional 76 // 77 // NOTE: FFI_USE_TypedCount MUST be set to true to make this field effective. 78 TypedCount int64 79 // Url is "HistoryItem.url" 80 // 81 // Optional 82 Url js.String 83 // VisitCount is "HistoryItem.visitCount" 84 // 85 // Optional 86 // 87 // NOTE: FFI_USE_VisitCount MUST be set to true to make this field effective. 88 VisitCount int64 89 90 FFI_USE_LastVisitTime bool // for LastVisitTime. 91 FFI_USE_TypedCount bool // for TypedCount. 92 FFI_USE_VisitCount bool // for VisitCount. 93 94 FFI_USE bool 95 } 96 97 // FromRef calls UpdateFrom and returns a HistoryItem with all fields set. 98 func (p HistoryItem) FromRef(ref js.Ref) HistoryItem { 99 p.UpdateFrom(ref) 100 return p 101 } 102 103 // New creates a new HistoryItem in the application heap. 104 func (p HistoryItem) New() js.Ref { 105 return bindings.HistoryItemJSLoad( 106 js.Pointer(&p), js.True, 0, 107 ) 108 } 109 110 // UpdateFrom copies value of all fields of the heap object to p. 111 func (p *HistoryItem) UpdateFrom(ref js.Ref) { 112 bindings.HistoryItemJSStore( 113 js.Pointer(p), ref, 114 ) 115 } 116 117 // Update writes all fields of the p to the heap object referenced by ref. 118 func (p *HistoryItem) Update(ref js.Ref) { 119 bindings.HistoryItemJSLoad( 120 js.Pointer(p), js.False, ref, 121 ) 122 } 123 124 // FreeMembers frees fields with heap reference, if recursive is true 125 // free all heap references reachable from p. 126 func (p *HistoryItem) FreeMembers(recursive bool) { 127 js.Free( 128 p.Id.Ref(), 129 p.Title.Ref(), 130 p.Url.Ref(), 131 ) 132 p.Id = p.Id.FromRef(js.Undefined) 133 p.Title = p.Title.FromRef(js.Undefined) 134 p.Url = p.Url.FromRef(js.Undefined) 135 } 136 137 type OnVisitRemovedArgRemoved struct { 138 // AllHistory is "OnVisitRemovedArgRemoved.allHistory" 139 // 140 // Required 141 AllHistory bool 142 // Urls is "OnVisitRemovedArgRemoved.urls" 143 // 144 // Optional 145 Urls js.Array[js.String] 146 147 FFI_USE bool 148 } 149 150 // FromRef calls UpdateFrom and returns a OnVisitRemovedArgRemoved with all fields set. 151 func (p OnVisitRemovedArgRemoved) FromRef(ref js.Ref) OnVisitRemovedArgRemoved { 152 p.UpdateFrom(ref) 153 return p 154 } 155 156 // New creates a new OnVisitRemovedArgRemoved in the application heap. 157 func (p OnVisitRemovedArgRemoved) New() js.Ref { 158 return bindings.OnVisitRemovedArgRemovedJSLoad( 159 js.Pointer(&p), js.True, 0, 160 ) 161 } 162 163 // UpdateFrom copies value of all fields of the heap object to p. 164 func (p *OnVisitRemovedArgRemoved) UpdateFrom(ref js.Ref) { 165 bindings.OnVisitRemovedArgRemovedJSStore( 166 js.Pointer(p), ref, 167 ) 168 } 169 170 // Update writes all fields of the p to the heap object referenced by ref. 171 func (p *OnVisitRemovedArgRemoved) Update(ref js.Ref) { 172 bindings.OnVisitRemovedArgRemovedJSLoad( 173 js.Pointer(p), js.False, ref, 174 ) 175 } 176 177 // FreeMembers frees fields with heap reference, if recursive is true 178 // free all heap references reachable from p. 179 func (p *OnVisitRemovedArgRemoved) FreeMembers(recursive bool) { 180 js.Free( 181 p.Urls.Ref(), 182 ) 183 p.Urls = p.Urls.FromRef(js.Undefined) 184 } 185 186 type SearchArgQuery struct { 187 // EndTime is "SearchArgQuery.endTime" 188 // 189 // Optional 190 // 191 // NOTE: FFI_USE_EndTime MUST be set to true to make this field effective. 192 EndTime float64 193 // MaxResults is "SearchArgQuery.maxResults" 194 // 195 // Optional 196 // 197 // NOTE: FFI_USE_MaxResults MUST be set to true to make this field effective. 198 MaxResults int64 199 // StartTime is "SearchArgQuery.startTime" 200 // 201 // Optional 202 // 203 // NOTE: FFI_USE_StartTime MUST be set to true to make this field effective. 204 StartTime float64 205 // Text is "SearchArgQuery.text" 206 // 207 // Required 208 Text js.String 209 210 FFI_USE_EndTime bool // for EndTime. 211 FFI_USE_MaxResults bool // for MaxResults. 212 FFI_USE_StartTime bool // for StartTime. 213 214 FFI_USE bool 215 } 216 217 // FromRef calls UpdateFrom and returns a SearchArgQuery with all fields set. 218 func (p SearchArgQuery) FromRef(ref js.Ref) SearchArgQuery { 219 p.UpdateFrom(ref) 220 return p 221 } 222 223 // New creates a new SearchArgQuery in the application heap. 224 func (p SearchArgQuery) New() js.Ref { 225 return bindings.SearchArgQueryJSLoad( 226 js.Pointer(&p), js.True, 0, 227 ) 228 } 229 230 // UpdateFrom copies value of all fields of the heap object to p. 231 func (p *SearchArgQuery) UpdateFrom(ref js.Ref) { 232 bindings.SearchArgQueryJSStore( 233 js.Pointer(p), ref, 234 ) 235 } 236 237 // Update writes all fields of the p to the heap object referenced by ref. 238 func (p *SearchArgQuery) Update(ref js.Ref) { 239 bindings.SearchArgQueryJSLoad( 240 js.Pointer(p), js.False, ref, 241 ) 242 } 243 244 // FreeMembers frees fields with heap reference, if recursive is true 245 // free all heap references reachable from p. 246 func (p *SearchArgQuery) FreeMembers(recursive bool) { 247 js.Free( 248 p.Text.Ref(), 249 ) 250 p.Text = p.Text.FromRef(js.Undefined) 251 } 252 253 type TransitionType uint32 254 255 const ( 256 _ TransitionType = iota 257 258 TransitionType_LINK 259 TransitionType_TYPED 260 TransitionType_AUTO_BOOKMARK 261 TransitionType_AUTO_SUBFRAME 262 TransitionType_MANUAL_SUBFRAME 263 TransitionType_GENERATED 264 TransitionType_AUTO_TOPLEVEL 265 TransitionType_FORM_SUBMIT 266 TransitionType_RELOAD 267 TransitionType_KEYWORD 268 TransitionType_KEYWORD_GENERATED 269 ) 270 271 func (TransitionType) FromRef(str js.Ref) TransitionType { 272 return TransitionType(bindings.ConstOfTransitionType(str)) 273 } 274 275 func (x TransitionType) String() (string, bool) { 276 switch x { 277 case TransitionType_LINK: 278 return "link", true 279 case TransitionType_TYPED: 280 return "typed", true 281 case TransitionType_AUTO_BOOKMARK: 282 return "auto_bookmark", true 283 case TransitionType_AUTO_SUBFRAME: 284 return "auto_subframe", true 285 case TransitionType_MANUAL_SUBFRAME: 286 return "manual_subframe", true 287 case TransitionType_GENERATED: 288 return "generated", true 289 case TransitionType_AUTO_TOPLEVEL: 290 return "auto_toplevel", true 291 case TransitionType_FORM_SUBMIT: 292 return "form_submit", true 293 case TransitionType_RELOAD: 294 return "reload", true 295 case TransitionType_KEYWORD: 296 return "keyword", true 297 case TransitionType_KEYWORD_GENERATED: 298 return "keyword_generated", true 299 default: 300 return "", false 301 } 302 } 303 304 type UrlDetails struct { 305 // Url is "UrlDetails.url" 306 // 307 // Required 308 Url js.String 309 310 FFI_USE bool 311 } 312 313 // FromRef calls UpdateFrom and returns a UrlDetails with all fields set. 314 func (p UrlDetails) FromRef(ref js.Ref) UrlDetails { 315 p.UpdateFrom(ref) 316 return p 317 } 318 319 // New creates a new UrlDetails in the application heap. 320 func (p UrlDetails) New() js.Ref { 321 return bindings.UrlDetailsJSLoad( 322 js.Pointer(&p), js.True, 0, 323 ) 324 } 325 326 // UpdateFrom copies value of all fields of the heap object to p. 327 func (p *UrlDetails) UpdateFrom(ref js.Ref) { 328 bindings.UrlDetailsJSStore( 329 js.Pointer(p), ref, 330 ) 331 } 332 333 // Update writes all fields of the p to the heap object referenced by ref. 334 func (p *UrlDetails) Update(ref js.Ref) { 335 bindings.UrlDetailsJSLoad( 336 js.Pointer(p), js.False, ref, 337 ) 338 } 339 340 // FreeMembers frees fields with heap reference, if recursive is true 341 // free all heap references reachable from p. 342 func (p *UrlDetails) FreeMembers(recursive bool) { 343 js.Free( 344 p.Url.Ref(), 345 ) 346 p.Url = p.Url.FromRef(js.Undefined) 347 } 348 349 type VisitItem struct { 350 // Id is "VisitItem.id" 351 // 352 // Required 353 Id js.String 354 // IsLocal is "VisitItem.isLocal" 355 // 356 // Required 357 IsLocal bool 358 // ReferringVisitId is "VisitItem.referringVisitId" 359 // 360 // Required 361 ReferringVisitId js.String 362 // Transition is "VisitItem.transition" 363 // 364 // Required 365 Transition TransitionType 366 // VisitId is "VisitItem.visitId" 367 // 368 // Required 369 VisitId js.String 370 // VisitTime is "VisitItem.visitTime" 371 // 372 // Optional 373 // 374 // NOTE: FFI_USE_VisitTime MUST be set to true to make this field effective. 375 VisitTime float64 376 377 FFI_USE_VisitTime bool // for VisitTime. 378 379 FFI_USE bool 380 } 381 382 // FromRef calls UpdateFrom and returns a VisitItem with all fields set. 383 func (p VisitItem) FromRef(ref js.Ref) VisitItem { 384 p.UpdateFrom(ref) 385 return p 386 } 387 388 // New creates a new VisitItem in the application heap. 389 func (p VisitItem) New() js.Ref { 390 return bindings.VisitItemJSLoad( 391 js.Pointer(&p), js.True, 0, 392 ) 393 } 394 395 // UpdateFrom copies value of all fields of the heap object to p. 396 func (p *VisitItem) UpdateFrom(ref js.Ref) { 397 bindings.VisitItemJSStore( 398 js.Pointer(p), ref, 399 ) 400 } 401 402 // Update writes all fields of the p to the heap object referenced by ref. 403 func (p *VisitItem) Update(ref js.Ref) { 404 bindings.VisitItemJSLoad( 405 js.Pointer(p), js.False, ref, 406 ) 407 } 408 409 // FreeMembers frees fields with heap reference, if recursive is true 410 // free all heap references reachable from p. 411 func (p *VisitItem) FreeMembers(recursive bool) { 412 js.Free( 413 p.Id.Ref(), 414 p.ReferringVisitId.Ref(), 415 p.VisitId.Ref(), 416 ) 417 p.Id = p.Id.FromRef(js.Undefined) 418 p.ReferringVisitId = p.ReferringVisitId.FromRef(js.Undefined) 419 p.VisitId = p.VisitId.FromRef(js.Undefined) 420 } 421 422 // HasFuncAddUrl returns true if the function "WEBEXT.history.addUrl" exists. 423 func HasFuncAddUrl() bool { 424 return js.True == bindings.HasFuncAddUrl() 425 } 426 427 // FuncAddUrl returns the function "WEBEXT.history.addUrl". 428 func FuncAddUrl() (fn js.Func[func(details UrlDetails) js.Promise[js.Void]]) { 429 bindings.FuncAddUrl( 430 js.Pointer(&fn), 431 ) 432 return 433 } 434 435 // AddUrl calls the function "WEBEXT.history.addUrl" directly. 436 func AddUrl(details UrlDetails) (ret js.Promise[js.Void]) { 437 bindings.CallAddUrl( 438 js.Pointer(&ret), 439 js.Pointer(&details), 440 ) 441 442 return 443 } 444 445 // TryAddUrl calls the function "WEBEXT.history.addUrl" 446 // in a try/catch block and returns (_, err, ok = false) when it went through 447 // the catch clause. 448 func TryAddUrl(details UrlDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 449 ok = js.True == bindings.TryAddUrl( 450 js.Pointer(&ret), js.Pointer(&exception), 451 js.Pointer(&details), 452 ) 453 454 return 455 } 456 457 // HasFuncDeleteAll returns true if the function "WEBEXT.history.deleteAll" exists. 458 func HasFuncDeleteAll() bool { 459 return js.True == bindings.HasFuncDeleteAll() 460 } 461 462 // FuncDeleteAll returns the function "WEBEXT.history.deleteAll". 463 func FuncDeleteAll() (fn js.Func[func() js.Promise[js.Void]]) { 464 bindings.FuncDeleteAll( 465 js.Pointer(&fn), 466 ) 467 return 468 } 469 470 // DeleteAll calls the function "WEBEXT.history.deleteAll" directly. 471 func DeleteAll() (ret js.Promise[js.Void]) { 472 bindings.CallDeleteAll( 473 js.Pointer(&ret), 474 ) 475 476 return 477 } 478 479 // TryDeleteAll calls the function "WEBEXT.history.deleteAll" 480 // in a try/catch block and returns (_, err, ok = false) when it went through 481 // the catch clause. 482 func TryDeleteAll() (ret js.Promise[js.Void], exception js.Any, ok bool) { 483 ok = js.True == bindings.TryDeleteAll( 484 js.Pointer(&ret), js.Pointer(&exception), 485 ) 486 487 return 488 } 489 490 // HasFuncDeleteRange returns true if the function "WEBEXT.history.deleteRange" exists. 491 func HasFuncDeleteRange() bool { 492 return js.True == bindings.HasFuncDeleteRange() 493 } 494 495 // FuncDeleteRange returns the function "WEBEXT.history.deleteRange". 496 func FuncDeleteRange() (fn js.Func[func(rng DeleteRangeArgRange) js.Promise[js.Void]]) { 497 bindings.FuncDeleteRange( 498 js.Pointer(&fn), 499 ) 500 return 501 } 502 503 // DeleteRange calls the function "WEBEXT.history.deleteRange" directly. 504 func DeleteRange(rng DeleteRangeArgRange) (ret js.Promise[js.Void]) { 505 bindings.CallDeleteRange( 506 js.Pointer(&ret), 507 js.Pointer(&rng), 508 ) 509 510 return 511 } 512 513 // TryDeleteRange calls the function "WEBEXT.history.deleteRange" 514 // in a try/catch block and returns (_, err, ok = false) when it went through 515 // the catch clause. 516 func TryDeleteRange(rng DeleteRangeArgRange) (ret js.Promise[js.Void], exception js.Any, ok bool) { 517 ok = js.True == bindings.TryDeleteRange( 518 js.Pointer(&ret), js.Pointer(&exception), 519 js.Pointer(&rng), 520 ) 521 522 return 523 } 524 525 // HasFuncDeleteUrl returns true if the function "WEBEXT.history.deleteUrl" exists. 526 func HasFuncDeleteUrl() bool { 527 return js.True == bindings.HasFuncDeleteUrl() 528 } 529 530 // FuncDeleteUrl returns the function "WEBEXT.history.deleteUrl". 531 func FuncDeleteUrl() (fn js.Func[func(details UrlDetails) js.Promise[js.Void]]) { 532 bindings.FuncDeleteUrl( 533 js.Pointer(&fn), 534 ) 535 return 536 } 537 538 // DeleteUrl calls the function "WEBEXT.history.deleteUrl" directly. 539 func DeleteUrl(details UrlDetails) (ret js.Promise[js.Void]) { 540 bindings.CallDeleteUrl( 541 js.Pointer(&ret), 542 js.Pointer(&details), 543 ) 544 545 return 546 } 547 548 // TryDeleteUrl calls the function "WEBEXT.history.deleteUrl" 549 // in a try/catch block and returns (_, err, ok = false) when it went through 550 // the catch clause. 551 func TryDeleteUrl(details UrlDetails) (ret js.Promise[js.Void], exception js.Any, ok bool) { 552 ok = js.True == bindings.TryDeleteUrl( 553 js.Pointer(&ret), js.Pointer(&exception), 554 js.Pointer(&details), 555 ) 556 557 return 558 } 559 560 // HasFuncGetVisits returns true if the function "WEBEXT.history.getVisits" exists. 561 func HasFuncGetVisits() bool { 562 return js.True == bindings.HasFuncGetVisits() 563 } 564 565 // FuncGetVisits returns the function "WEBEXT.history.getVisits". 566 func FuncGetVisits() (fn js.Func[func(details UrlDetails) js.Promise[js.Array[VisitItem]]]) { 567 bindings.FuncGetVisits( 568 js.Pointer(&fn), 569 ) 570 return 571 } 572 573 // GetVisits calls the function "WEBEXT.history.getVisits" directly. 574 func GetVisits(details UrlDetails) (ret js.Promise[js.Array[VisitItem]]) { 575 bindings.CallGetVisits( 576 js.Pointer(&ret), 577 js.Pointer(&details), 578 ) 579 580 return 581 } 582 583 // TryGetVisits calls the function "WEBEXT.history.getVisits" 584 // in a try/catch block and returns (_, err, ok = false) when it went through 585 // the catch clause. 586 func TryGetVisits(details UrlDetails) (ret js.Promise[js.Array[VisitItem]], exception js.Any, ok bool) { 587 ok = js.True == bindings.TryGetVisits( 588 js.Pointer(&ret), js.Pointer(&exception), 589 js.Pointer(&details), 590 ) 591 592 return 593 } 594 595 type OnVisitRemovedEventCallbackFunc func(this js.Ref, removed *OnVisitRemovedArgRemoved) js.Ref 596 597 func (fn OnVisitRemovedEventCallbackFunc) Register() js.Func[func(removed *OnVisitRemovedArgRemoved)] { 598 return js.RegisterCallback[func(removed *OnVisitRemovedArgRemoved)]( 599 fn, abi.FuncPCABIInternal(fn), 600 ) 601 } 602 603 func (fn OnVisitRemovedEventCallbackFunc) DispatchCallback( 604 targetPC uintptr, ctx *js.CallbackContext, 605 ) { 606 args := ctx.Args() 607 if len(args) != 1+1 /* js this */ || 608 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 609 js.ThrowInvalidCallbackInvocation() 610 } 611 var arg0 OnVisitRemovedArgRemoved 612 arg0.UpdateFrom(args[0+1]) 613 defer arg0.FreeMembers(true) 614 615 if ctx.Return(fn( 616 args[0], 617 618 mark.NoEscape(&arg0), 619 )) { 620 return 621 } 622 623 js.ThrowCallbackValueNotReturned() 624 } 625 626 type OnVisitRemovedEventCallback[T any] struct { 627 Fn func(arg T, this js.Ref, removed *OnVisitRemovedArgRemoved) js.Ref 628 Arg T 629 } 630 631 func (cb *OnVisitRemovedEventCallback[T]) Register() js.Func[func(removed *OnVisitRemovedArgRemoved)] { 632 return js.RegisterCallback[func(removed *OnVisitRemovedArgRemoved)]( 633 cb, abi.FuncPCABIInternal(cb.Fn), 634 ) 635 } 636 637 func (cb *OnVisitRemovedEventCallback[T]) DispatchCallback( 638 targetPC uintptr, ctx *js.CallbackContext, 639 ) { 640 args := ctx.Args() 641 if len(args) != 1+1 /* js this */ || 642 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 643 js.ThrowInvalidCallbackInvocation() 644 } 645 var arg0 OnVisitRemovedArgRemoved 646 arg0.UpdateFrom(args[0+1]) 647 defer arg0.FreeMembers(true) 648 649 if ctx.Return(cb.Fn( 650 cb.Arg, 651 args[0], 652 653 mark.NoEscape(&arg0), 654 )) { 655 return 656 } 657 658 js.ThrowCallbackValueNotReturned() 659 } 660 661 // HasFuncOnVisitRemoved returns true if the function "WEBEXT.history.onVisitRemoved.addListener" exists. 662 func HasFuncOnVisitRemoved() bool { 663 return js.True == bindings.HasFuncOnVisitRemoved() 664 } 665 666 // FuncOnVisitRemoved returns the function "WEBEXT.history.onVisitRemoved.addListener". 667 func FuncOnVisitRemoved() (fn js.Func[func(callback js.Func[func(removed *OnVisitRemovedArgRemoved)])]) { 668 bindings.FuncOnVisitRemoved( 669 js.Pointer(&fn), 670 ) 671 return 672 } 673 674 // OnVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.addListener" directly. 675 func OnVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret js.Void) { 676 bindings.CallOnVisitRemoved( 677 js.Pointer(&ret), 678 callback.Ref(), 679 ) 680 681 return 682 } 683 684 // TryOnVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.addListener" 685 // in a try/catch block and returns (_, err, ok = false) when it went through 686 // the catch clause. 687 func TryOnVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret js.Void, exception js.Any, ok bool) { 688 ok = js.True == bindings.TryOnVisitRemoved( 689 js.Pointer(&ret), js.Pointer(&exception), 690 callback.Ref(), 691 ) 692 693 return 694 } 695 696 // HasFuncOffVisitRemoved returns true if the function "WEBEXT.history.onVisitRemoved.removeListener" exists. 697 func HasFuncOffVisitRemoved() bool { 698 return js.True == bindings.HasFuncOffVisitRemoved() 699 } 700 701 // FuncOffVisitRemoved returns the function "WEBEXT.history.onVisitRemoved.removeListener". 702 func FuncOffVisitRemoved() (fn js.Func[func(callback js.Func[func(removed *OnVisitRemovedArgRemoved)])]) { 703 bindings.FuncOffVisitRemoved( 704 js.Pointer(&fn), 705 ) 706 return 707 } 708 709 // OffVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.removeListener" directly. 710 func OffVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret js.Void) { 711 bindings.CallOffVisitRemoved( 712 js.Pointer(&ret), 713 callback.Ref(), 714 ) 715 716 return 717 } 718 719 // TryOffVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.removeListener" 720 // in a try/catch block and returns (_, err, ok = false) when it went through 721 // the catch clause. 722 func TryOffVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret js.Void, exception js.Any, ok bool) { 723 ok = js.True == bindings.TryOffVisitRemoved( 724 js.Pointer(&ret), js.Pointer(&exception), 725 callback.Ref(), 726 ) 727 728 return 729 } 730 731 // HasFuncHasOnVisitRemoved returns true if the function "WEBEXT.history.onVisitRemoved.hasListener" exists. 732 func HasFuncHasOnVisitRemoved() bool { 733 return js.True == bindings.HasFuncHasOnVisitRemoved() 734 } 735 736 // FuncHasOnVisitRemoved returns the function "WEBEXT.history.onVisitRemoved.hasListener". 737 func FuncHasOnVisitRemoved() (fn js.Func[func(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) bool]) { 738 bindings.FuncHasOnVisitRemoved( 739 js.Pointer(&fn), 740 ) 741 return 742 } 743 744 // HasOnVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.hasListener" directly. 745 func HasOnVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret bool) { 746 bindings.CallHasOnVisitRemoved( 747 js.Pointer(&ret), 748 callback.Ref(), 749 ) 750 751 return 752 } 753 754 // TryHasOnVisitRemoved calls the function "WEBEXT.history.onVisitRemoved.hasListener" 755 // in a try/catch block and returns (_, err, ok = false) when it went through 756 // the catch clause. 757 func TryHasOnVisitRemoved(callback js.Func[func(removed *OnVisitRemovedArgRemoved)]) (ret bool, exception js.Any, ok bool) { 758 ok = js.True == bindings.TryHasOnVisitRemoved( 759 js.Pointer(&ret), js.Pointer(&exception), 760 callback.Ref(), 761 ) 762 763 return 764 } 765 766 type OnVisitedEventCallbackFunc func(this js.Ref, result *HistoryItem) js.Ref 767 768 func (fn OnVisitedEventCallbackFunc) Register() js.Func[func(result *HistoryItem)] { 769 return js.RegisterCallback[func(result *HistoryItem)]( 770 fn, abi.FuncPCABIInternal(fn), 771 ) 772 } 773 774 func (fn OnVisitedEventCallbackFunc) DispatchCallback( 775 targetPC uintptr, ctx *js.CallbackContext, 776 ) { 777 args := ctx.Args() 778 if len(args) != 1+1 /* js this */ || 779 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 780 js.ThrowInvalidCallbackInvocation() 781 } 782 var arg0 HistoryItem 783 arg0.UpdateFrom(args[0+1]) 784 defer arg0.FreeMembers(true) 785 786 if ctx.Return(fn( 787 args[0], 788 789 mark.NoEscape(&arg0), 790 )) { 791 return 792 } 793 794 js.ThrowCallbackValueNotReturned() 795 } 796 797 type OnVisitedEventCallback[T any] struct { 798 Fn func(arg T, this js.Ref, result *HistoryItem) js.Ref 799 Arg T 800 } 801 802 func (cb *OnVisitedEventCallback[T]) Register() js.Func[func(result *HistoryItem)] { 803 return js.RegisterCallback[func(result *HistoryItem)]( 804 cb, abi.FuncPCABIInternal(cb.Fn), 805 ) 806 } 807 808 func (cb *OnVisitedEventCallback[T]) DispatchCallback( 809 targetPC uintptr, ctx *js.CallbackContext, 810 ) { 811 args := ctx.Args() 812 if len(args) != 1+1 /* js this */ || 813 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 814 js.ThrowInvalidCallbackInvocation() 815 } 816 var arg0 HistoryItem 817 arg0.UpdateFrom(args[0+1]) 818 defer arg0.FreeMembers(true) 819 820 if ctx.Return(cb.Fn( 821 cb.Arg, 822 args[0], 823 824 mark.NoEscape(&arg0), 825 )) { 826 return 827 } 828 829 js.ThrowCallbackValueNotReturned() 830 } 831 832 // HasFuncOnVisited returns true if the function "WEBEXT.history.onVisited.addListener" exists. 833 func HasFuncOnVisited() bool { 834 return js.True == bindings.HasFuncOnVisited() 835 } 836 837 // FuncOnVisited returns the function "WEBEXT.history.onVisited.addListener". 838 func FuncOnVisited() (fn js.Func[func(callback js.Func[func(result *HistoryItem)])]) { 839 bindings.FuncOnVisited( 840 js.Pointer(&fn), 841 ) 842 return 843 } 844 845 // OnVisited calls the function "WEBEXT.history.onVisited.addListener" directly. 846 func OnVisited(callback js.Func[func(result *HistoryItem)]) (ret js.Void) { 847 bindings.CallOnVisited( 848 js.Pointer(&ret), 849 callback.Ref(), 850 ) 851 852 return 853 } 854 855 // TryOnVisited calls the function "WEBEXT.history.onVisited.addListener" 856 // in a try/catch block and returns (_, err, ok = false) when it went through 857 // the catch clause. 858 func TryOnVisited(callback js.Func[func(result *HistoryItem)]) (ret js.Void, exception js.Any, ok bool) { 859 ok = js.True == bindings.TryOnVisited( 860 js.Pointer(&ret), js.Pointer(&exception), 861 callback.Ref(), 862 ) 863 864 return 865 } 866 867 // HasFuncOffVisited returns true if the function "WEBEXT.history.onVisited.removeListener" exists. 868 func HasFuncOffVisited() bool { 869 return js.True == bindings.HasFuncOffVisited() 870 } 871 872 // FuncOffVisited returns the function "WEBEXT.history.onVisited.removeListener". 873 func FuncOffVisited() (fn js.Func[func(callback js.Func[func(result *HistoryItem)])]) { 874 bindings.FuncOffVisited( 875 js.Pointer(&fn), 876 ) 877 return 878 } 879 880 // OffVisited calls the function "WEBEXT.history.onVisited.removeListener" directly. 881 func OffVisited(callback js.Func[func(result *HistoryItem)]) (ret js.Void) { 882 bindings.CallOffVisited( 883 js.Pointer(&ret), 884 callback.Ref(), 885 ) 886 887 return 888 } 889 890 // TryOffVisited calls the function "WEBEXT.history.onVisited.removeListener" 891 // in a try/catch block and returns (_, err, ok = false) when it went through 892 // the catch clause. 893 func TryOffVisited(callback js.Func[func(result *HistoryItem)]) (ret js.Void, exception js.Any, ok bool) { 894 ok = js.True == bindings.TryOffVisited( 895 js.Pointer(&ret), js.Pointer(&exception), 896 callback.Ref(), 897 ) 898 899 return 900 } 901 902 // HasFuncHasOnVisited returns true if the function "WEBEXT.history.onVisited.hasListener" exists. 903 func HasFuncHasOnVisited() bool { 904 return js.True == bindings.HasFuncHasOnVisited() 905 } 906 907 // FuncHasOnVisited returns the function "WEBEXT.history.onVisited.hasListener". 908 func FuncHasOnVisited() (fn js.Func[func(callback js.Func[func(result *HistoryItem)]) bool]) { 909 bindings.FuncHasOnVisited( 910 js.Pointer(&fn), 911 ) 912 return 913 } 914 915 // HasOnVisited calls the function "WEBEXT.history.onVisited.hasListener" directly. 916 func HasOnVisited(callback js.Func[func(result *HistoryItem)]) (ret bool) { 917 bindings.CallHasOnVisited( 918 js.Pointer(&ret), 919 callback.Ref(), 920 ) 921 922 return 923 } 924 925 // TryHasOnVisited calls the function "WEBEXT.history.onVisited.hasListener" 926 // in a try/catch block and returns (_, err, ok = false) when it went through 927 // the catch clause. 928 func TryHasOnVisited(callback js.Func[func(result *HistoryItem)]) (ret bool, exception js.Any, ok bool) { 929 ok = js.True == bindings.TryHasOnVisited( 930 js.Pointer(&ret), js.Pointer(&exception), 931 callback.Ref(), 932 ) 933 934 return 935 } 936 937 // HasFuncSearch returns true if the function "WEBEXT.history.search" exists. 938 func HasFuncSearch() bool { 939 return js.True == bindings.HasFuncSearch() 940 } 941 942 // FuncSearch returns the function "WEBEXT.history.search". 943 func FuncSearch() (fn js.Func[func(query SearchArgQuery) js.Promise[js.Array[HistoryItem]]]) { 944 bindings.FuncSearch( 945 js.Pointer(&fn), 946 ) 947 return 948 } 949 950 // Search calls the function "WEBEXT.history.search" directly. 951 func Search(query SearchArgQuery) (ret js.Promise[js.Array[HistoryItem]]) { 952 bindings.CallSearch( 953 js.Pointer(&ret), 954 js.Pointer(&query), 955 ) 956 957 return 958 } 959 960 // TrySearch calls the function "WEBEXT.history.search" 961 // in a try/catch block and returns (_, err, ok = false) when it went through 962 // the catch clause. 963 func TrySearch(query SearchArgQuery) (ret js.Promise[js.Array[HistoryItem]], exception js.Any, ok bool) { 964 ok = js.True == bindings.TrySearch( 965 js.Pointer(&ret), js.Pointer(&exception), 966 js.Pointer(&query), 967 ) 968 969 return 970 }