github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/settingsprivate/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package settingsprivate 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/settingsprivate/bindings" 11 ) 12 13 type ControlledBy uint32 14 15 const ( 16 _ ControlledBy = iota 17 18 ControlledBy_DEVICE_POLICY 19 ControlledBy_USER_POLICY 20 ControlledBy_OWNER 21 ControlledBy_PRIMARY_USER 22 ControlledBy_EXTENSION 23 ControlledBy_PARENT 24 ControlledBy_CHILD_RESTRICTION 25 ) 26 27 func (ControlledBy) FromRef(str js.Ref) ControlledBy { 28 return ControlledBy(bindings.ConstOfControlledBy(str)) 29 } 30 31 func (x ControlledBy) String() (string, bool) { 32 switch x { 33 case ControlledBy_DEVICE_POLICY: 34 return "DEVICE_POLICY", true 35 case ControlledBy_USER_POLICY: 36 return "USER_POLICY", true 37 case ControlledBy_OWNER: 38 return "OWNER", true 39 case ControlledBy_PRIMARY_USER: 40 return "PRIMARY_USER", true 41 case ControlledBy_EXTENSION: 42 return "EXTENSION", true 43 case ControlledBy_PARENT: 44 return "PARENT", true 45 case ControlledBy_CHILD_RESTRICTION: 46 return "CHILD_RESTRICTION", true 47 default: 48 return "", false 49 } 50 } 51 52 type Enforcement uint32 53 54 const ( 55 _ Enforcement = iota 56 57 Enforcement_ENFORCED 58 Enforcement_RECOMMENDED 59 Enforcement_PARENT_SUPERVISED 60 ) 61 62 func (Enforcement) FromRef(str js.Ref) Enforcement { 63 return Enforcement(bindings.ConstOfEnforcement(str)) 64 } 65 66 func (x Enforcement) String() (string, bool) { 67 switch x { 68 case Enforcement_ENFORCED: 69 return "ENFORCED", true 70 case Enforcement_RECOMMENDED: 71 return "RECOMMENDED", true 72 case Enforcement_PARENT_SUPERVISED: 73 return "PARENT_SUPERVISED", true 74 default: 75 return "", false 76 } 77 } 78 79 type GetAllPrefsCallbackFunc func(this js.Ref, prefs js.Array[PrefObject]) js.Ref 80 81 func (fn GetAllPrefsCallbackFunc) Register() js.Func[func(prefs js.Array[PrefObject])] { 82 return js.RegisterCallback[func(prefs js.Array[PrefObject])]( 83 fn, abi.FuncPCABIInternal(fn), 84 ) 85 } 86 87 func (fn GetAllPrefsCallbackFunc) DispatchCallback( 88 targetPC uintptr, ctx *js.CallbackContext, 89 ) { 90 args := ctx.Args() 91 if len(args) != 1+1 /* js this */ || 92 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 93 js.ThrowInvalidCallbackInvocation() 94 } 95 96 if ctx.Return(fn( 97 args[0], 98 99 js.Array[PrefObject]{}.FromRef(args[0+1]), 100 )) { 101 return 102 } 103 104 js.ThrowCallbackValueNotReturned() 105 } 106 107 type GetAllPrefsCallback[T any] struct { 108 Fn func(arg T, this js.Ref, prefs js.Array[PrefObject]) js.Ref 109 Arg T 110 } 111 112 func (cb *GetAllPrefsCallback[T]) Register() js.Func[func(prefs js.Array[PrefObject])] { 113 return js.RegisterCallback[func(prefs js.Array[PrefObject])]( 114 cb, abi.FuncPCABIInternal(cb.Fn), 115 ) 116 } 117 118 func (cb *GetAllPrefsCallback[T]) DispatchCallback( 119 targetPC uintptr, ctx *js.CallbackContext, 120 ) { 121 args := ctx.Args() 122 if len(args) != 1+1 /* js this */ || 123 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 124 js.ThrowInvalidCallbackInvocation() 125 } 126 127 if ctx.Return(cb.Fn( 128 cb.Arg, 129 args[0], 130 131 js.Array[PrefObject]{}.FromRef(args[0+1]), 132 )) { 133 return 134 } 135 136 js.ThrowCallbackValueNotReturned() 137 } 138 139 type PrefType uint32 140 141 const ( 142 _ PrefType = iota 143 144 PrefType_BOOLEAN 145 PrefType_NUMBER 146 PrefType_STRING 147 PrefType_URL 148 PrefType_LIST 149 PrefType_DICTIONARY 150 ) 151 152 func (PrefType) FromRef(str js.Ref) PrefType { 153 return PrefType(bindings.ConstOfPrefType(str)) 154 } 155 156 func (x PrefType) String() (string, bool) { 157 switch x { 158 case PrefType_BOOLEAN: 159 return "BOOLEAN", true 160 case PrefType_NUMBER: 161 return "NUMBER", true 162 case PrefType_STRING: 163 return "STRING", true 164 case PrefType_URL: 165 return "URL", true 166 case PrefType_LIST: 167 return "LIST", true 168 case PrefType_DICTIONARY: 169 return "DICTIONARY", true 170 default: 171 return "", false 172 } 173 } 174 175 type PrefObject struct { 176 // Key is "PrefObject.key" 177 // 178 // Optional 179 Key js.String 180 // Type is "PrefObject.type" 181 // 182 // Optional 183 Type PrefType 184 // Value is "PrefObject.value" 185 // 186 // Optional 187 Value js.Any 188 // ControlledBy is "PrefObject.controlledBy" 189 // 190 // Optional 191 ControlledBy ControlledBy 192 // ControlledByName is "PrefObject.controlledByName" 193 // 194 // Optional 195 ControlledByName js.String 196 // Enforcement is "PrefObject.enforcement" 197 // 198 // Optional 199 Enforcement Enforcement 200 // RecommendedValue is "PrefObject.recommendedValue" 201 // 202 // Optional 203 RecommendedValue js.Any 204 // UserSelectableValues is "PrefObject.userSelectableValues" 205 // 206 // Optional 207 UserSelectableValues js.Array[js.Any] 208 // UserControlDisabled is "PrefObject.userControlDisabled" 209 // 210 // Optional 211 // 212 // NOTE: FFI_USE_UserControlDisabled MUST be set to true to make this field effective. 213 UserControlDisabled bool 214 // ExtensionId is "PrefObject.extensionId" 215 // 216 // Optional 217 ExtensionId js.String 218 // ExtensionCanBeDisabled is "PrefObject.extensionCanBeDisabled" 219 // 220 // Optional 221 // 222 // NOTE: FFI_USE_ExtensionCanBeDisabled MUST be set to true to make this field effective. 223 ExtensionCanBeDisabled bool 224 225 FFI_USE_UserControlDisabled bool // for UserControlDisabled. 226 FFI_USE_ExtensionCanBeDisabled bool // for ExtensionCanBeDisabled. 227 228 FFI_USE bool 229 } 230 231 // FromRef calls UpdateFrom and returns a PrefObject with all fields set. 232 func (p PrefObject) FromRef(ref js.Ref) PrefObject { 233 p.UpdateFrom(ref) 234 return p 235 } 236 237 // New creates a new PrefObject in the application heap. 238 func (p PrefObject) New() js.Ref { 239 return bindings.PrefObjectJSLoad( 240 js.Pointer(&p), js.True, 0, 241 ) 242 } 243 244 // UpdateFrom copies value of all fields of the heap object to p. 245 func (p *PrefObject) UpdateFrom(ref js.Ref) { 246 bindings.PrefObjectJSStore( 247 js.Pointer(p), ref, 248 ) 249 } 250 251 // Update writes all fields of the p to the heap object referenced by ref. 252 func (p *PrefObject) Update(ref js.Ref) { 253 bindings.PrefObjectJSLoad( 254 js.Pointer(p), js.False, ref, 255 ) 256 } 257 258 // FreeMembers frees fields with heap reference, if recursive is true 259 // free all heap references reachable from p. 260 func (p *PrefObject) FreeMembers(recursive bool) { 261 js.Free( 262 p.Key.Ref(), 263 p.Value.Ref(), 264 p.ControlledByName.Ref(), 265 p.RecommendedValue.Ref(), 266 p.UserSelectableValues.Ref(), 267 p.ExtensionId.Ref(), 268 ) 269 p.Key = p.Key.FromRef(js.Undefined) 270 p.Value = p.Value.FromRef(js.Undefined) 271 p.ControlledByName = p.ControlledByName.FromRef(js.Undefined) 272 p.RecommendedValue = p.RecommendedValue.FromRef(js.Undefined) 273 p.UserSelectableValues = p.UserSelectableValues.FromRef(js.Undefined) 274 p.ExtensionId = p.ExtensionId.FromRef(js.Undefined) 275 } 276 277 type GetDefaultZoomCallbackFunc func(this js.Ref, zoom float64) js.Ref 278 279 func (fn GetDefaultZoomCallbackFunc) Register() js.Func[func(zoom float64)] { 280 return js.RegisterCallback[func(zoom float64)]( 281 fn, abi.FuncPCABIInternal(fn), 282 ) 283 } 284 285 func (fn GetDefaultZoomCallbackFunc) DispatchCallback( 286 targetPC uintptr, ctx *js.CallbackContext, 287 ) { 288 args := ctx.Args() 289 if len(args) != 1+1 /* js this */ || 290 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 291 js.ThrowInvalidCallbackInvocation() 292 } 293 294 if ctx.Return(fn( 295 args[0], 296 297 js.Number[float64]{}.FromRef(args[0+1]).Get(), 298 )) { 299 return 300 } 301 302 js.ThrowCallbackValueNotReturned() 303 } 304 305 type GetDefaultZoomCallback[T any] struct { 306 Fn func(arg T, this js.Ref, zoom float64) js.Ref 307 Arg T 308 } 309 310 func (cb *GetDefaultZoomCallback[T]) Register() js.Func[func(zoom float64)] { 311 return js.RegisterCallback[func(zoom float64)]( 312 cb, abi.FuncPCABIInternal(cb.Fn), 313 ) 314 } 315 316 func (cb *GetDefaultZoomCallback[T]) DispatchCallback( 317 targetPC uintptr, ctx *js.CallbackContext, 318 ) { 319 args := ctx.Args() 320 if len(args) != 1+1 /* js this */ || 321 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 322 js.ThrowInvalidCallbackInvocation() 323 } 324 325 if ctx.Return(cb.Fn( 326 cb.Arg, 327 args[0], 328 329 js.Number[float64]{}.FromRef(args[0+1]).Get(), 330 )) { 331 return 332 } 333 334 js.ThrowCallbackValueNotReturned() 335 } 336 337 type GetPrefCallbackFunc func(this js.Ref, pref *PrefObject) js.Ref 338 339 func (fn GetPrefCallbackFunc) Register() js.Func[func(pref *PrefObject)] { 340 return js.RegisterCallback[func(pref *PrefObject)]( 341 fn, abi.FuncPCABIInternal(fn), 342 ) 343 } 344 345 func (fn GetPrefCallbackFunc) DispatchCallback( 346 targetPC uintptr, ctx *js.CallbackContext, 347 ) { 348 args := ctx.Args() 349 if len(args) != 1+1 /* js this */ || 350 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 351 js.ThrowInvalidCallbackInvocation() 352 } 353 var arg0 PrefObject 354 arg0.UpdateFrom(args[0+1]) 355 defer arg0.FreeMembers(true) 356 357 if ctx.Return(fn( 358 args[0], 359 360 mark.NoEscape(&arg0), 361 )) { 362 return 363 } 364 365 js.ThrowCallbackValueNotReturned() 366 } 367 368 type GetPrefCallback[T any] struct { 369 Fn func(arg T, this js.Ref, pref *PrefObject) js.Ref 370 Arg T 371 } 372 373 func (cb *GetPrefCallback[T]) Register() js.Func[func(pref *PrefObject)] { 374 return js.RegisterCallback[func(pref *PrefObject)]( 375 cb, abi.FuncPCABIInternal(cb.Fn), 376 ) 377 } 378 379 func (cb *GetPrefCallback[T]) DispatchCallback( 380 targetPC uintptr, ctx *js.CallbackContext, 381 ) { 382 args := ctx.Args() 383 if len(args) != 1+1 /* js this */ || 384 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 385 js.ThrowInvalidCallbackInvocation() 386 } 387 var arg0 PrefObject 388 arg0.UpdateFrom(args[0+1]) 389 defer arg0.FreeMembers(true) 390 391 if ctx.Return(cb.Fn( 392 cb.Arg, 393 args[0], 394 395 mark.NoEscape(&arg0), 396 )) { 397 return 398 } 399 400 js.ThrowCallbackValueNotReturned() 401 } 402 403 type OnPrefSetCallbackFunc func(this js.Ref, success bool) js.Ref 404 405 func (fn OnPrefSetCallbackFunc) Register() js.Func[func(success bool)] { 406 return js.RegisterCallback[func(success bool)]( 407 fn, abi.FuncPCABIInternal(fn), 408 ) 409 } 410 411 func (fn OnPrefSetCallbackFunc) DispatchCallback( 412 targetPC uintptr, ctx *js.CallbackContext, 413 ) { 414 args := ctx.Args() 415 if len(args) != 1+1 /* js this */ || 416 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 417 js.ThrowInvalidCallbackInvocation() 418 } 419 420 if ctx.Return(fn( 421 args[0], 422 423 args[0+1] == js.True, 424 )) { 425 return 426 } 427 428 js.ThrowCallbackValueNotReturned() 429 } 430 431 type OnPrefSetCallback[T any] struct { 432 Fn func(arg T, this js.Ref, success bool) js.Ref 433 Arg T 434 } 435 436 func (cb *OnPrefSetCallback[T]) Register() js.Func[func(success bool)] { 437 return js.RegisterCallback[func(success bool)]( 438 cb, abi.FuncPCABIInternal(cb.Fn), 439 ) 440 } 441 442 func (cb *OnPrefSetCallback[T]) DispatchCallback( 443 targetPC uintptr, ctx *js.CallbackContext, 444 ) { 445 args := ctx.Args() 446 if len(args) != 1+1 /* js this */ || 447 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 448 js.ThrowInvalidCallbackInvocation() 449 } 450 451 if ctx.Return(cb.Fn( 452 cb.Arg, 453 args[0], 454 455 args[0+1] == js.True, 456 )) { 457 return 458 } 459 460 js.ThrowCallbackValueNotReturned() 461 } 462 463 type SetDefaultZoomCallbackFunc func(this js.Ref, success bool) js.Ref 464 465 func (fn SetDefaultZoomCallbackFunc) Register() js.Func[func(success bool)] { 466 return js.RegisterCallback[func(success bool)]( 467 fn, abi.FuncPCABIInternal(fn), 468 ) 469 } 470 471 func (fn SetDefaultZoomCallbackFunc) DispatchCallback( 472 targetPC uintptr, ctx *js.CallbackContext, 473 ) { 474 args := ctx.Args() 475 if len(args) != 1+1 /* js this */ || 476 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 477 js.ThrowInvalidCallbackInvocation() 478 } 479 480 if ctx.Return(fn( 481 args[0], 482 483 args[0+1] == js.True, 484 )) { 485 return 486 } 487 488 js.ThrowCallbackValueNotReturned() 489 } 490 491 type SetDefaultZoomCallback[T any] struct { 492 Fn func(arg T, this js.Ref, success bool) js.Ref 493 Arg T 494 } 495 496 func (cb *SetDefaultZoomCallback[T]) Register() js.Func[func(success bool)] { 497 return js.RegisterCallback[func(success bool)]( 498 cb, abi.FuncPCABIInternal(cb.Fn), 499 ) 500 } 501 502 func (cb *SetDefaultZoomCallback[T]) DispatchCallback( 503 targetPC uintptr, ctx *js.CallbackContext, 504 ) { 505 args := ctx.Args() 506 if len(args) != 1+1 /* js this */ || 507 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 508 js.ThrowInvalidCallbackInvocation() 509 } 510 511 if ctx.Return(cb.Fn( 512 cb.Arg, 513 args[0], 514 515 args[0+1] == js.True, 516 )) { 517 return 518 } 519 520 js.ThrowCallbackValueNotReturned() 521 } 522 523 // HasFuncGetAllPrefs returns true if the function "WEBEXT.settingsPrivate.getAllPrefs" exists. 524 func HasFuncGetAllPrefs() bool { 525 return js.True == bindings.HasFuncGetAllPrefs() 526 } 527 528 // FuncGetAllPrefs returns the function "WEBEXT.settingsPrivate.getAllPrefs". 529 func FuncGetAllPrefs() (fn js.Func[func() js.Promise[js.Array[PrefObject]]]) { 530 bindings.FuncGetAllPrefs( 531 js.Pointer(&fn), 532 ) 533 return 534 } 535 536 // GetAllPrefs calls the function "WEBEXT.settingsPrivate.getAllPrefs" directly. 537 func GetAllPrefs() (ret js.Promise[js.Array[PrefObject]]) { 538 bindings.CallGetAllPrefs( 539 js.Pointer(&ret), 540 ) 541 542 return 543 } 544 545 // TryGetAllPrefs calls the function "WEBEXT.settingsPrivate.getAllPrefs" 546 // in a try/catch block and returns (_, err, ok = false) when it went through 547 // the catch clause. 548 func TryGetAllPrefs() (ret js.Promise[js.Array[PrefObject]], exception js.Any, ok bool) { 549 ok = js.True == bindings.TryGetAllPrefs( 550 js.Pointer(&ret), js.Pointer(&exception), 551 ) 552 553 return 554 } 555 556 // HasFuncGetDefaultZoom returns true if the function "WEBEXT.settingsPrivate.getDefaultZoom" exists. 557 func HasFuncGetDefaultZoom() bool { 558 return js.True == bindings.HasFuncGetDefaultZoom() 559 } 560 561 // FuncGetDefaultZoom returns the function "WEBEXT.settingsPrivate.getDefaultZoom". 562 func FuncGetDefaultZoom() (fn js.Func[func() js.Promise[js.Number[float64]]]) { 563 bindings.FuncGetDefaultZoom( 564 js.Pointer(&fn), 565 ) 566 return 567 } 568 569 // GetDefaultZoom calls the function "WEBEXT.settingsPrivate.getDefaultZoom" directly. 570 func GetDefaultZoom() (ret js.Promise[js.Number[float64]]) { 571 bindings.CallGetDefaultZoom( 572 js.Pointer(&ret), 573 ) 574 575 return 576 } 577 578 // TryGetDefaultZoom calls the function "WEBEXT.settingsPrivate.getDefaultZoom" 579 // in a try/catch block and returns (_, err, ok = false) when it went through 580 // the catch clause. 581 func TryGetDefaultZoom() (ret js.Promise[js.Number[float64]], exception js.Any, ok bool) { 582 ok = js.True == bindings.TryGetDefaultZoom( 583 js.Pointer(&ret), js.Pointer(&exception), 584 ) 585 586 return 587 } 588 589 // HasFuncGetPref returns true if the function "WEBEXT.settingsPrivate.getPref" exists. 590 func HasFuncGetPref() bool { 591 return js.True == bindings.HasFuncGetPref() 592 } 593 594 // FuncGetPref returns the function "WEBEXT.settingsPrivate.getPref". 595 func FuncGetPref() (fn js.Func[func(name js.String) js.Promise[PrefObject]]) { 596 bindings.FuncGetPref( 597 js.Pointer(&fn), 598 ) 599 return 600 } 601 602 // GetPref calls the function "WEBEXT.settingsPrivate.getPref" directly. 603 func GetPref(name js.String) (ret js.Promise[PrefObject]) { 604 bindings.CallGetPref( 605 js.Pointer(&ret), 606 name.Ref(), 607 ) 608 609 return 610 } 611 612 // TryGetPref calls the function "WEBEXT.settingsPrivate.getPref" 613 // in a try/catch block and returns (_, err, ok = false) when it went through 614 // the catch clause. 615 func TryGetPref(name js.String) (ret js.Promise[PrefObject], exception js.Any, ok bool) { 616 ok = js.True == bindings.TryGetPref( 617 js.Pointer(&ret), js.Pointer(&exception), 618 name.Ref(), 619 ) 620 621 return 622 } 623 624 type OnPrefsChangedEventCallbackFunc func(this js.Ref, prefs js.Array[PrefObject]) js.Ref 625 626 func (fn OnPrefsChangedEventCallbackFunc) Register() js.Func[func(prefs js.Array[PrefObject])] { 627 return js.RegisterCallback[func(prefs js.Array[PrefObject])]( 628 fn, abi.FuncPCABIInternal(fn), 629 ) 630 } 631 632 func (fn OnPrefsChangedEventCallbackFunc) DispatchCallback( 633 targetPC uintptr, ctx *js.CallbackContext, 634 ) { 635 args := ctx.Args() 636 if len(args) != 1+1 /* js this */ || 637 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 638 js.ThrowInvalidCallbackInvocation() 639 } 640 641 if ctx.Return(fn( 642 args[0], 643 644 js.Array[PrefObject]{}.FromRef(args[0+1]), 645 )) { 646 return 647 } 648 649 js.ThrowCallbackValueNotReturned() 650 } 651 652 type OnPrefsChangedEventCallback[T any] struct { 653 Fn func(arg T, this js.Ref, prefs js.Array[PrefObject]) js.Ref 654 Arg T 655 } 656 657 func (cb *OnPrefsChangedEventCallback[T]) Register() js.Func[func(prefs js.Array[PrefObject])] { 658 return js.RegisterCallback[func(prefs js.Array[PrefObject])]( 659 cb, abi.FuncPCABIInternal(cb.Fn), 660 ) 661 } 662 663 func (cb *OnPrefsChangedEventCallback[T]) DispatchCallback( 664 targetPC uintptr, ctx *js.CallbackContext, 665 ) { 666 args := ctx.Args() 667 if len(args) != 1+1 /* js this */ || 668 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 669 js.ThrowInvalidCallbackInvocation() 670 } 671 672 if ctx.Return(cb.Fn( 673 cb.Arg, 674 args[0], 675 676 js.Array[PrefObject]{}.FromRef(args[0+1]), 677 )) { 678 return 679 } 680 681 js.ThrowCallbackValueNotReturned() 682 } 683 684 // HasFuncOnPrefsChanged returns true if the function "WEBEXT.settingsPrivate.onPrefsChanged.addListener" exists. 685 func HasFuncOnPrefsChanged() bool { 686 return js.True == bindings.HasFuncOnPrefsChanged() 687 } 688 689 // FuncOnPrefsChanged returns the function "WEBEXT.settingsPrivate.onPrefsChanged.addListener". 690 func FuncOnPrefsChanged() (fn js.Func[func(callback js.Func[func(prefs js.Array[PrefObject])])]) { 691 bindings.FuncOnPrefsChanged( 692 js.Pointer(&fn), 693 ) 694 return 695 } 696 697 // OnPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.addListener" directly. 698 func OnPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret js.Void) { 699 bindings.CallOnPrefsChanged( 700 js.Pointer(&ret), 701 callback.Ref(), 702 ) 703 704 return 705 } 706 707 // TryOnPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.addListener" 708 // in a try/catch block and returns (_, err, ok = false) when it went through 709 // the catch clause. 710 func TryOnPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret js.Void, exception js.Any, ok bool) { 711 ok = js.True == bindings.TryOnPrefsChanged( 712 js.Pointer(&ret), js.Pointer(&exception), 713 callback.Ref(), 714 ) 715 716 return 717 } 718 719 // HasFuncOffPrefsChanged returns true if the function "WEBEXT.settingsPrivate.onPrefsChanged.removeListener" exists. 720 func HasFuncOffPrefsChanged() bool { 721 return js.True == bindings.HasFuncOffPrefsChanged() 722 } 723 724 // FuncOffPrefsChanged returns the function "WEBEXT.settingsPrivate.onPrefsChanged.removeListener". 725 func FuncOffPrefsChanged() (fn js.Func[func(callback js.Func[func(prefs js.Array[PrefObject])])]) { 726 bindings.FuncOffPrefsChanged( 727 js.Pointer(&fn), 728 ) 729 return 730 } 731 732 // OffPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.removeListener" directly. 733 func OffPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret js.Void) { 734 bindings.CallOffPrefsChanged( 735 js.Pointer(&ret), 736 callback.Ref(), 737 ) 738 739 return 740 } 741 742 // TryOffPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.removeListener" 743 // in a try/catch block and returns (_, err, ok = false) when it went through 744 // the catch clause. 745 func TryOffPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret js.Void, exception js.Any, ok bool) { 746 ok = js.True == bindings.TryOffPrefsChanged( 747 js.Pointer(&ret), js.Pointer(&exception), 748 callback.Ref(), 749 ) 750 751 return 752 } 753 754 // HasFuncHasOnPrefsChanged returns true if the function "WEBEXT.settingsPrivate.onPrefsChanged.hasListener" exists. 755 func HasFuncHasOnPrefsChanged() bool { 756 return js.True == bindings.HasFuncHasOnPrefsChanged() 757 } 758 759 // FuncHasOnPrefsChanged returns the function "WEBEXT.settingsPrivate.onPrefsChanged.hasListener". 760 func FuncHasOnPrefsChanged() (fn js.Func[func(callback js.Func[func(prefs js.Array[PrefObject])]) bool]) { 761 bindings.FuncHasOnPrefsChanged( 762 js.Pointer(&fn), 763 ) 764 return 765 } 766 767 // HasOnPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.hasListener" directly. 768 func HasOnPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret bool) { 769 bindings.CallHasOnPrefsChanged( 770 js.Pointer(&ret), 771 callback.Ref(), 772 ) 773 774 return 775 } 776 777 // TryHasOnPrefsChanged calls the function "WEBEXT.settingsPrivate.onPrefsChanged.hasListener" 778 // in a try/catch block and returns (_, err, ok = false) when it went through 779 // the catch clause. 780 func TryHasOnPrefsChanged(callback js.Func[func(prefs js.Array[PrefObject])]) (ret bool, exception js.Any, ok bool) { 781 ok = js.True == bindings.TryHasOnPrefsChanged( 782 js.Pointer(&ret), js.Pointer(&exception), 783 callback.Ref(), 784 ) 785 786 return 787 } 788 789 // HasFuncSetDefaultZoom returns true if the function "WEBEXT.settingsPrivate.setDefaultZoom" exists. 790 func HasFuncSetDefaultZoom() bool { 791 return js.True == bindings.HasFuncSetDefaultZoom() 792 } 793 794 // FuncSetDefaultZoom returns the function "WEBEXT.settingsPrivate.setDefaultZoom". 795 func FuncSetDefaultZoom() (fn js.Func[func(zoom float64) js.Promise[js.Boolean]]) { 796 bindings.FuncSetDefaultZoom( 797 js.Pointer(&fn), 798 ) 799 return 800 } 801 802 // SetDefaultZoom calls the function "WEBEXT.settingsPrivate.setDefaultZoom" directly. 803 func SetDefaultZoom(zoom float64) (ret js.Promise[js.Boolean]) { 804 bindings.CallSetDefaultZoom( 805 js.Pointer(&ret), 806 float64(zoom), 807 ) 808 809 return 810 } 811 812 // TrySetDefaultZoom calls the function "WEBEXT.settingsPrivate.setDefaultZoom" 813 // in a try/catch block and returns (_, err, ok = false) when it went through 814 // the catch clause. 815 func TrySetDefaultZoom(zoom float64) (ret js.Promise[js.Boolean], exception js.Any, ok bool) { 816 ok = js.True == bindings.TrySetDefaultZoom( 817 js.Pointer(&ret), js.Pointer(&exception), 818 float64(zoom), 819 ) 820 821 return 822 } 823 824 // HasFuncSetPref returns true if the function "WEBEXT.settingsPrivate.setPref" exists. 825 func HasFuncSetPref() bool { 826 return js.True == bindings.HasFuncSetPref() 827 } 828 829 // FuncSetPref returns the function "WEBEXT.settingsPrivate.setPref". 830 func FuncSetPref() (fn js.Func[func(name js.String, value js.Any, pageId js.String) js.Promise[js.Boolean]]) { 831 bindings.FuncSetPref( 832 js.Pointer(&fn), 833 ) 834 return 835 } 836 837 // SetPref calls the function "WEBEXT.settingsPrivate.setPref" directly. 838 func SetPref(name js.String, value js.Any, pageId js.String) (ret js.Promise[js.Boolean]) { 839 bindings.CallSetPref( 840 js.Pointer(&ret), 841 name.Ref(), 842 value.Ref(), 843 pageId.Ref(), 844 ) 845 846 return 847 } 848 849 // TrySetPref calls the function "WEBEXT.settingsPrivate.setPref" 850 // in a try/catch block and returns (_, err, ok = false) when it went through 851 // the catch clause. 852 func TrySetPref(name js.String, value js.Any, pageId js.String) (ret js.Promise[js.Boolean], exception js.Any, ok bool) { 853 ok = js.True == bindings.TrySetPref( 854 js.Pointer(&ret), js.Pointer(&exception), 855 name.Ref(), 856 value.Ref(), 857 pageId.Ref(), 858 ) 859 860 return 861 }