github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/ttsengine/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package ttsengine 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/tts" 11 "github.com/primecitizens/pcz/std/plat/js/webext/ttsengine/bindings" 12 ) 13 14 type AudioBuffer struct { 15 // AudioBuffer is "AudioBuffer.audioBuffer" 16 // 17 // Required 18 AudioBuffer js.TypedArray[uint8] 19 // CharIndex is "AudioBuffer.charIndex" 20 // 21 // Optional 22 // 23 // NOTE: FFI_USE_CharIndex MUST be set to true to make this field effective. 24 CharIndex int64 25 // IsLastBuffer is "AudioBuffer.isLastBuffer" 26 // 27 // Optional 28 // 29 // NOTE: FFI_USE_IsLastBuffer MUST be set to true to make this field effective. 30 IsLastBuffer bool 31 32 FFI_USE_CharIndex bool // for CharIndex. 33 FFI_USE_IsLastBuffer bool // for IsLastBuffer. 34 35 FFI_USE bool 36 } 37 38 // FromRef calls UpdateFrom and returns a AudioBuffer with all fields set. 39 func (p AudioBuffer) FromRef(ref js.Ref) AudioBuffer { 40 p.UpdateFrom(ref) 41 return p 42 } 43 44 // New creates a new AudioBuffer in the application heap. 45 func (p AudioBuffer) New() js.Ref { 46 return bindings.AudioBufferJSLoad( 47 js.Pointer(&p), js.True, 0, 48 ) 49 } 50 51 // UpdateFrom copies value of all fields of the heap object to p. 52 func (p *AudioBuffer) UpdateFrom(ref js.Ref) { 53 bindings.AudioBufferJSStore( 54 js.Pointer(p), ref, 55 ) 56 } 57 58 // Update writes all fields of the p to the heap object referenced by ref. 59 func (p *AudioBuffer) Update(ref js.Ref) { 60 bindings.AudioBufferJSLoad( 61 js.Pointer(p), js.False, ref, 62 ) 63 } 64 65 // FreeMembers frees fields with heap reference, if recursive is true 66 // free all heap references reachable from p. 67 func (p *AudioBuffer) FreeMembers(recursive bool) { 68 js.Free( 69 p.AudioBuffer.Ref(), 70 ) 71 p.AudioBuffer = p.AudioBuffer.FromRef(js.Undefined) 72 } 73 74 type AudioStreamOptions struct { 75 // BufferSize is "AudioStreamOptions.bufferSize" 76 // 77 // Required 78 BufferSize int64 79 // SampleRate is "AudioStreamOptions.sampleRate" 80 // 81 // Required 82 SampleRate int64 83 84 FFI_USE bool 85 } 86 87 // FromRef calls UpdateFrom and returns a AudioStreamOptions with all fields set. 88 func (p AudioStreamOptions) FromRef(ref js.Ref) AudioStreamOptions { 89 p.UpdateFrom(ref) 90 return p 91 } 92 93 // New creates a new AudioStreamOptions in the application heap. 94 func (p AudioStreamOptions) New() js.Ref { 95 return bindings.AudioStreamOptionsJSLoad( 96 js.Pointer(&p), js.True, 0, 97 ) 98 } 99 100 // UpdateFrom copies value of all fields of the heap object to p. 101 func (p *AudioStreamOptions) UpdateFrom(ref js.Ref) { 102 bindings.AudioStreamOptionsJSStore( 103 js.Pointer(p), ref, 104 ) 105 } 106 107 // Update writes all fields of the p to the heap object referenced by ref. 108 func (p *AudioStreamOptions) Update(ref js.Ref) { 109 bindings.AudioStreamOptionsJSLoad( 110 js.Pointer(p), js.False, ref, 111 ) 112 } 113 114 // FreeMembers frees fields with heap reference, if recursive is true 115 // free all heap references reachable from p. 116 func (p *AudioStreamOptions) FreeMembers(recursive bool) { 117 } 118 119 type OnSpeakArgSendTtsEventFunc func(this js.Ref, event *tts.TtsEvent) js.Ref 120 121 func (fn OnSpeakArgSendTtsEventFunc) Register() js.Func[func(event *tts.TtsEvent)] { 122 return js.RegisterCallback[func(event *tts.TtsEvent)]( 123 fn, abi.FuncPCABIInternal(fn), 124 ) 125 } 126 127 func (fn OnSpeakArgSendTtsEventFunc) DispatchCallback( 128 targetPC uintptr, ctx *js.CallbackContext, 129 ) { 130 args := ctx.Args() 131 if len(args) != 1+1 /* js this */ || 132 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 133 js.ThrowInvalidCallbackInvocation() 134 } 135 var arg0 tts.TtsEvent 136 arg0.UpdateFrom(args[0+1]) 137 defer arg0.FreeMembers(true) 138 139 if ctx.Return(fn( 140 args[0], 141 142 mark.NoEscape(&arg0), 143 )) { 144 return 145 } 146 147 js.ThrowCallbackValueNotReturned() 148 } 149 150 type OnSpeakArgSendTtsEvent[T any] struct { 151 Fn func(arg T, this js.Ref, event *tts.TtsEvent) js.Ref 152 Arg T 153 } 154 155 func (cb *OnSpeakArgSendTtsEvent[T]) Register() js.Func[func(event *tts.TtsEvent)] { 156 return js.RegisterCallback[func(event *tts.TtsEvent)]( 157 cb, abi.FuncPCABIInternal(cb.Fn), 158 ) 159 } 160 161 func (cb *OnSpeakArgSendTtsEvent[T]) DispatchCallback( 162 targetPC uintptr, ctx *js.CallbackContext, 163 ) { 164 args := ctx.Args() 165 if len(args) != 1+1 /* js this */ || 166 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 167 js.ThrowInvalidCallbackInvocation() 168 } 169 var arg0 tts.TtsEvent 170 arg0.UpdateFrom(args[0+1]) 171 defer arg0.FreeMembers(true) 172 173 if ctx.Return(cb.Fn( 174 cb.Arg, 175 args[0], 176 177 mark.NoEscape(&arg0), 178 )) { 179 return 180 } 181 182 js.ThrowCallbackValueNotReturned() 183 } 184 185 type OnSpeakWithAudioStreamArgSendErrorFunc func(this js.Ref, errorMessage js.String) js.Ref 186 187 func (fn OnSpeakWithAudioStreamArgSendErrorFunc) Register() js.Func[func(errorMessage js.String)] { 188 return js.RegisterCallback[func(errorMessage js.String)]( 189 fn, abi.FuncPCABIInternal(fn), 190 ) 191 } 192 193 func (fn OnSpeakWithAudioStreamArgSendErrorFunc) DispatchCallback( 194 targetPC uintptr, ctx *js.CallbackContext, 195 ) { 196 args := ctx.Args() 197 if len(args) != 1+1 /* js this */ || 198 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 199 js.ThrowInvalidCallbackInvocation() 200 } 201 202 if ctx.Return(fn( 203 args[0], 204 205 js.String{}.FromRef(args[0+1]), 206 )) { 207 return 208 } 209 210 js.ThrowCallbackValueNotReturned() 211 } 212 213 type OnSpeakWithAudioStreamArgSendError[T any] struct { 214 Fn func(arg T, this js.Ref, errorMessage js.String) js.Ref 215 Arg T 216 } 217 218 func (cb *OnSpeakWithAudioStreamArgSendError[T]) Register() js.Func[func(errorMessage js.String)] { 219 return js.RegisterCallback[func(errorMessage js.String)]( 220 cb, abi.FuncPCABIInternal(cb.Fn), 221 ) 222 } 223 224 func (cb *OnSpeakWithAudioStreamArgSendError[T]) DispatchCallback( 225 targetPC uintptr, ctx *js.CallbackContext, 226 ) { 227 args := ctx.Args() 228 if len(args) != 1+1 /* js this */ || 229 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 230 js.ThrowInvalidCallbackInvocation() 231 } 232 233 if ctx.Return(cb.Fn( 234 cb.Arg, 235 args[0], 236 237 js.String{}.FromRef(args[0+1]), 238 )) { 239 return 240 } 241 242 js.ThrowCallbackValueNotReturned() 243 } 244 245 type OnSpeakWithAudioStreamArgSendTtsAudioFunc func(this js.Ref, audioBufferParams *AudioBuffer) js.Ref 246 247 func (fn OnSpeakWithAudioStreamArgSendTtsAudioFunc) Register() js.Func[func(audioBufferParams *AudioBuffer)] { 248 return js.RegisterCallback[func(audioBufferParams *AudioBuffer)]( 249 fn, abi.FuncPCABIInternal(fn), 250 ) 251 } 252 253 func (fn OnSpeakWithAudioStreamArgSendTtsAudioFunc) DispatchCallback( 254 targetPC uintptr, ctx *js.CallbackContext, 255 ) { 256 args := ctx.Args() 257 if len(args) != 1+1 /* js this */ || 258 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 259 js.ThrowInvalidCallbackInvocation() 260 } 261 var arg0 AudioBuffer 262 arg0.UpdateFrom(args[0+1]) 263 defer arg0.FreeMembers(true) 264 265 if ctx.Return(fn( 266 args[0], 267 268 mark.NoEscape(&arg0), 269 )) { 270 return 271 } 272 273 js.ThrowCallbackValueNotReturned() 274 } 275 276 type OnSpeakWithAudioStreamArgSendTtsAudio[T any] struct { 277 Fn func(arg T, this js.Ref, audioBufferParams *AudioBuffer) js.Ref 278 Arg T 279 } 280 281 func (cb *OnSpeakWithAudioStreamArgSendTtsAudio[T]) Register() js.Func[func(audioBufferParams *AudioBuffer)] { 282 return js.RegisterCallback[func(audioBufferParams *AudioBuffer)]( 283 cb, abi.FuncPCABIInternal(cb.Fn), 284 ) 285 } 286 287 func (cb *OnSpeakWithAudioStreamArgSendTtsAudio[T]) DispatchCallback( 288 targetPC uintptr, ctx *js.CallbackContext, 289 ) { 290 args := ctx.Args() 291 if len(args) != 1+1 /* js this */ || 292 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 293 js.ThrowInvalidCallbackInvocation() 294 } 295 var arg0 AudioBuffer 296 arg0.UpdateFrom(args[0+1]) 297 defer arg0.FreeMembers(true) 298 299 if ctx.Return(cb.Fn( 300 cb.Arg, 301 args[0], 302 303 mark.NoEscape(&arg0), 304 )) { 305 return 306 } 307 308 js.ThrowCallbackValueNotReturned() 309 } 310 311 type VoiceGender uint32 312 313 const ( 314 _ VoiceGender = iota 315 316 VoiceGender_MALE 317 VoiceGender_FEMALE 318 ) 319 320 func (VoiceGender) FromRef(str js.Ref) VoiceGender { 321 return VoiceGender(bindings.ConstOfVoiceGender(str)) 322 } 323 324 func (x VoiceGender) String() (string, bool) { 325 switch x { 326 case VoiceGender_MALE: 327 return "male", true 328 case VoiceGender_FEMALE: 329 return "female", true 330 default: 331 return "", false 332 } 333 } 334 335 type SpeakOptions struct { 336 // Gender is "SpeakOptions.gender" 337 // 338 // Optional 339 Gender VoiceGender 340 // Lang is "SpeakOptions.lang" 341 // 342 // Optional 343 Lang js.String 344 // Pitch is "SpeakOptions.pitch" 345 // 346 // Optional 347 // 348 // NOTE: FFI_USE_Pitch MUST be set to true to make this field effective. 349 Pitch float64 350 // Rate is "SpeakOptions.rate" 351 // 352 // Optional 353 // 354 // NOTE: FFI_USE_Rate MUST be set to true to make this field effective. 355 Rate float64 356 // VoiceName is "SpeakOptions.voiceName" 357 // 358 // Optional 359 VoiceName js.String 360 // Volume is "SpeakOptions.volume" 361 // 362 // Optional 363 // 364 // NOTE: FFI_USE_Volume MUST be set to true to make this field effective. 365 Volume float64 366 367 FFI_USE_Pitch bool // for Pitch. 368 FFI_USE_Rate bool // for Rate. 369 FFI_USE_Volume bool // for Volume. 370 371 FFI_USE bool 372 } 373 374 // FromRef calls UpdateFrom and returns a SpeakOptions with all fields set. 375 func (p SpeakOptions) FromRef(ref js.Ref) SpeakOptions { 376 p.UpdateFrom(ref) 377 return p 378 } 379 380 // New creates a new SpeakOptions in the application heap. 381 func (p SpeakOptions) New() js.Ref { 382 return bindings.SpeakOptionsJSLoad( 383 js.Pointer(&p), js.True, 0, 384 ) 385 } 386 387 // UpdateFrom copies value of all fields of the heap object to p. 388 func (p *SpeakOptions) UpdateFrom(ref js.Ref) { 389 bindings.SpeakOptionsJSStore( 390 js.Pointer(p), ref, 391 ) 392 } 393 394 // Update writes all fields of the p to the heap object referenced by ref. 395 func (p *SpeakOptions) Update(ref js.Ref) { 396 bindings.SpeakOptionsJSLoad( 397 js.Pointer(p), js.False, ref, 398 ) 399 } 400 401 // FreeMembers frees fields with heap reference, if recursive is true 402 // free all heap references reachable from p. 403 func (p *SpeakOptions) FreeMembers(recursive bool) { 404 js.Free( 405 p.Lang.Ref(), 406 p.VoiceName.Ref(), 407 ) 408 p.Lang = p.Lang.FromRef(js.Undefined) 409 p.VoiceName = p.VoiceName.FromRef(js.Undefined) 410 } 411 412 type OnPauseEventCallbackFunc func(this js.Ref) js.Ref 413 414 func (fn OnPauseEventCallbackFunc) Register() js.Func[func()] { 415 return js.RegisterCallback[func()]( 416 fn, abi.FuncPCABIInternal(fn), 417 ) 418 } 419 420 func (fn OnPauseEventCallbackFunc) DispatchCallback( 421 targetPC uintptr, ctx *js.CallbackContext, 422 ) { 423 args := ctx.Args() 424 if len(args) != 0+1 /* js this */ || 425 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 426 js.ThrowInvalidCallbackInvocation() 427 } 428 429 if ctx.Return(fn( 430 args[0], 431 )) { 432 return 433 } 434 435 js.ThrowCallbackValueNotReturned() 436 } 437 438 type OnPauseEventCallback[T any] struct { 439 Fn func(arg T, this js.Ref) js.Ref 440 Arg T 441 } 442 443 func (cb *OnPauseEventCallback[T]) Register() js.Func[func()] { 444 return js.RegisterCallback[func()]( 445 cb, abi.FuncPCABIInternal(cb.Fn), 446 ) 447 } 448 449 func (cb *OnPauseEventCallback[T]) DispatchCallback( 450 targetPC uintptr, ctx *js.CallbackContext, 451 ) { 452 args := ctx.Args() 453 if len(args) != 0+1 /* js this */ || 454 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 455 js.ThrowInvalidCallbackInvocation() 456 } 457 458 if ctx.Return(cb.Fn( 459 cb.Arg, 460 args[0], 461 )) { 462 return 463 } 464 465 js.ThrowCallbackValueNotReturned() 466 } 467 468 // HasFuncOnPause returns true if the function "WEBEXT.ttsEngine.onPause.addListener" exists. 469 func HasFuncOnPause() bool { 470 return js.True == bindings.HasFuncOnPause() 471 } 472 473 // FuncOnPause returns the function "WEBEXT.ttsEngine.onPause.addListener". 474 func FuncOnPause() (fn js.Func[func(callback js.Func[func()])]) { 475 bindings.FuncOnPause( 476 js.Pointer(&fn), 477 ) 478 return 479 } 480 481 // OnPause calls the function "WEBEXT.ttsEngine.onPause.addListener" directly. 482 func OnPause(callback js.Func[func()]) (ret js.Void) { 483 bindings.CallOnPause( 484 js.Pointer(&ret), 485 callback.Ref(), 486 ) 487 488 return 489 } 490 491 // TryOnPause calls the function "WEBEXT.ttsEngine.onPause.addListener" 492 // in a try/catch block and returns (_, err, ok = false) when it went through 493 // the catch clause. 494 func TryOnPause(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 495 ok = js.True == bindings.TryOnPause( 496 js.Pointer(&ret), js.Pointer(&exception), 497 callback.Ref(), 498 ) 499 500 return 501 } 502 503 // HasFuncOffPause returns true if the function "WEBEXT.ttsEngine.onPause.removeListener" exists. 504 func HasFuncOffPause() bool { 505 return js.True == bindings.HasFuncOffPause() 506 } 507 508 // FuncOffPause returns the function "WEBEXT.ttsEngine.onPause.removeListener". 509 func FuncOffPause() (fn js.Func[func(callback js.Func[func()])]) { 510 bindings.FuncOffPause( 511 js.Pointer(&fn), 512 ) 513 return 514 } 515 516 // OffPause calls the function "WEBEXT.ttsEngine.onPause.removeListener" directly. 517 func OffPause(callback js.Func[func()]) (ret js.Void) { 518 bindings.CallOffPause( 519 js.Pointer(&ret), 520 callback.Ref(), 521 ) 522 523 return 524 } 525 526 // TryOffPause calls the function "WEBEXT.ttsEngine.onPause.removeListener" 527 // in a try/catch block and returns (_, err, ok = false) when it went through 528 // the catch clause. 529 func TryOffPause(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 530 ok = js.True == bindings.TryOffPause( 531 js.Pointer(&ret), js.Pointer(&exception), 532 callback.Ref(), 533 ) 534 535 return 536 } 537 538 // HasFuncHasOnPause returns true if the function "WEBEXT.ttsEngine.onPause.hasListener" exists. 539 func HasFuncHasOnPause() bool { 540 return js.True == bindings.HasFuncHasOnPause() 541 } 542 543 // FuncHasOnPause returns the function "WEBEXT.ttsEngine.onPause.hasListener". 544 func FuncHasOnPause() (fn js.Func[func(callback js.Func[func()]) bool]) { 545 bindings.FuncHasOnPause( 546 js.Pointer(&fn), 547 ) 548 return 549 } 550 551 // HasOnPause calls the function "WEBEXT.ttsEngine.onPause.hasListener" directly. 552 func HasOnPause(callback js.Func[func()]) (ret bool) { 553 bindings.CallHasOnPause( 554 js.Pointer(&ret), 555 callback.Ref(), 556 ) 557 558 return 559 } 560 561 // TryHasOnPause calls the function "WEBEXT.ttsEngine.onPause.hasListener" 562 // in a try/catch block and returns (_, err, ok = false) when it went through 563 // the catch clause. 564 func TryHasOnPause(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) { 565 ok = js.True == bindings.TryHasOnPause( 566 js.Pointer(&ret), js.Pointer(&exception), 567 callback.Ref(), 568 ) 569 570 return 571 } 572 573 type OnResumeEventCallbackFunc func(this js.Ref) js.Ref 574 575 func (fn OnResumeEventCallbackFunc) Register() js.Func[func()] { 576 return js.RegisterCallback[func()]( 577 fn, abi.FuncPCABIInternal(fn), 578 ) 579 } 580 581 func (fn OnResumeEventCallbackFunc) DispatchCallback( 582 targetPC uintptr, ctx *js.CallbackContext, 583 ) { 584 args := ctx.Args() 585 if len(args) != 0+1 /* js this */ || 586 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 587 js.ThrowInvalidCallbackInvocation() 588 } 589 590 if ctx.Return(fn( 591 args[0], 592 )) { 593 return 594 } 595 596 js.ThrowCallbackValueNotReturned() 597 } 598 599 type OnResumeEventCallback[T any] struct { 600 Fn func(arg T, this js.Ref) js.Ref 601 Arg T 602 } 603 604 func (cb *OnResumeEventCallback[T]) Register() js.Func[func()] { 605 return js.RegisterCallback[func()]( 606 cb, abi.FuncPCABIInternal(cb.Fn), 607 ) 608 } 609 610 func (cb *OnResumeEventCallback[T]) DispatchCallback( 611 targetPC uintptr, ctx *js.CallbackContext, 612 ) { 613 args := ctx.Args() 614 if len(args) != 0+1 /* js this */ || 615 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 616 js.ThrowInvalidCallbackInvocation() 617 } 618 619 if ctx.Return(cb.Fn( 620 cb.Arg, 621 args[0], 622 )) { 623 return 624 } 625 626 js.ThrowCallbackValueNotReturned() 627 } 628 629 // HasFuncOnResume returns true if the function "WEBEXT.ttsEngine.onResume.addListener" exists. 630 func HasFuncOnResume() bool { 631 return js.True == bindings.HasFuncOnResume() 632 } 633 634 // FuncOnResume returns the function "WEBEXT.ttsEngine.onResume.addListener". 635 func FuncOnResume() (fn js.Func[func(callback js.Func[func()])]) { 636 bindings.FuncOnResume( 637 js.Pointer(&fn), 638 ) 639 return 640 } 641 642 // OnResume calls the function "WEBEXT.ttsEngine.onResume.addListener" directly. 643 func OnResume(callback js.Func[func()]) (ret js.Void) { 644 bindings.CallOnResume( 645 js.Pointer(&ret), 646 callback.Ref(), 647 ) 648 649 return 650 } 651 652 // TryOnResume calls the function "WEBEXT.ttsEngine.onResume.addListener" 653 // in a try/catch block and returns (_, err, ok = false) when it went through 654 // the catch clause. 655 func TryOnResume(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 656 ok = js.True == bindings.TryOnResume( 657 js.Pointer(&ret), js.Pointer(&exception), 658 callback.Ref(), 659 ) 660 661 return 662 } 663 664 // HasFuncOffResume returns true if the function "WEBEXT.ttsEngine.onResume.removeListener" exists. 665 func HasFuncOffResume() bool { 666 return js.True == bindings.HasFuncOffResume() 667 } 668 669 // FuncOffResume returns the function "WEBEXT.ttsEngine.onResume.removeListener". 670 func FuncOffResume() (fn js.Func[func(callback js.Func[func()])]) { 671 bindings.FuncOffResume( 672 js.Pointer(&fn), 673 ) 674 return 675 } 676 677 // OffResume calls the function "WEBEXT.ttsEngine.onResume.removeListener" directly. 678 func OffResume(callback js.Func[func()]) (ret js.Void) { 679 bindings.CallOffResume( 680 js.Pointer(&ret), 681 callback.Ref(), 682 ) 683 684 return 685 } 686 687 // TryOffResume calls the function "WEBEXT.ttsEngine.onResume.removeListener" 688 // in a try/catch block and returns (_, err, ok = false) when it went through 689 // the catch clause. 690 func TryOffResume(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 691 ok = js.True == bindings.TryOffResume( 692 js.Pointer(&ret), js.Pointer(&exception), 693 callback.Ref(), 694 ) 695 696 return 697 } 698 699 // HasFuncHasOnResume returns true if the function "WEBEXT.ttsEngine.onResume.hasListener" exists. 700 func HasFuncHasOnResume() bool { 701 return js.True == bindings.HasFuncHasOnResume() 702 } 703 704 // FuncHasOnResume returns the function "WEBEXT.ttsEngine.onResume.hasListener". 705 func FuncHasOnResume() (fn js.Func[func(callback js.Func[func()]) bool]) { 706 bindings.FuncHasOnResume( 707 js.Pointer(&fn), 708 ) 709 return 710 } 711 712 // HasOnResume calls the function "WEBEXT.ttsEngine.onResume.hasListener" directly. 713 func HasOnResume(callback js.Func[func()]) (ret bool) { 714 bindings.CallHasOnResume( 715 js.Pointer(&ret), 716 callback.Ref(), 717 ) 718 719 return 720 } 721 722 // TryHasOnResume calls the function "WEBEXT.ttsEngine.onResume.hasListener" 723 // in a try/catch block and returns (_, err, ok = false) when it went through 724 // the catch clause. 725 func TryHasOnResume(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) { 726 ok = js.True == bindings.TryHasOnResume( 727 js.Pointer(&ret), js.Pointer(&exception), 728 callback.Ref(), 729 ) 730 731 return 732 } 733 734 type OnSpeakEventCallbackFunc func(this js.Ref, utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)]) js.Ref 735 736 func (fn OnSpeakEventCallbackFunc) Register() js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])] { 737 return js.RegisterCallback[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]( 738 fn, abi.FuncPCABIInternal(fn), 739 ) 740 } 741 742 func (fn OnSpeakEventCallbackFunc) DispatchCallback( 743 targetPC uintptr, ctx *js.CallbackContext, 744 ) { 745 args := ctx.Args() 746 if len(args) != 3+1 /* js this */ || 747 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 748 js.ThrowInvalidCallbackInvocation() 749 } 750 var arg1 SpeakOptions 751 arg1.UpdateFrom(args[1+1]) 752 defer arg1.FreeMembers(true) 753 754 if ctx.Return(fn( 755 args[0], 756 757 js.String{}.FromRef(args[0+1]), 758 mark.NoEscape(&arg1), 759 js.Func[func(event *tts.TtsEvent)]{}.FromRef(args[2+1]), 760 )) { 761 return 762 } 763 764 js.ThrowCallbackValueNotReturned() 765 } 766 767 type OnSpeakEventCallback[T any] struct { 768 Fn func(arg T, this js.Ref, utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)]) js.Ref 769 Arg T 770 } 771 772 func (cb *OnSpeakEventCallback[T]) Register() js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])] { 773 return js.RegisterCallback[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]( 774 cb, abi.FuncPCABIInternal(cb.Fn), 775 ) 776 } 777 778 func (cb *OnSpeakEventCallback[T]) DispatchCallback( 779 targetPC uintptr, ctx *js.CallbackContext, 780 ) { 781 args := ctx.Args() 782 if len(args) != 3+1 /* js this */ || 783 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 784 js.ThrowInvalidCallbackInvocation() 785 } 786 var arg1 SpeakOptions 787 arg1.UpdateFrom(args[1+1]) 788 defer arg1.FreeMembers(true) 789 790 if ctx.Return(cb.Fn( 791 cb.Arg, 792 args[0], 793 794 js.String{}.FromRef(args[0+1]), 795 mark.NoEscape(&arg1), 796 js.Func[func(event *tts.TtsEvent)]{}.FromRef(args[2+1]), 797 )) { 798 return 799 } 800 801 js.ThrowCallbackValueNotReturned() 802 } 803 804 // HasFuncOnSpeak returns true if the function "WEBEXT.ttsEngine.onSpeak.addListener" exists. 805 func HasFuncOnSpeak() bool { 806 return js.True == bindings.HasFuncOnSpeak() 807 } 808 809 // FuncOnSpeak returns the function "WEBEXT.ttsEngine.onSpeak.addListener". 810 func FuncOnSpeak() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])])]) { 811 bindings.FuncOnSpeak( 812 js.Pointer(&fn), 813 ) 814 return 815 } 816 817 // OnSpeak calls the function "WEBEXT.ttsEngine.onSpeak.addListener" directly. 818 func OnSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret js.Void) { 819 bindings.CallOnSpeak( 820 js.Pointer(&ret), 821 callback.Ref(), 822 ) 823 824 return 825 } 826 827 // TryOnSpeak calls the function "WEBEXT.ttsEngine.onSpeak.addListener" 828 // in a try/catch block and returns (_, err, ok = false) when it went through 829 // the catch clause. 830 func TryOnSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret js.Void, exception js.Any, ok bool) { 831 ok = js.True == bindings.TryOnSpeak( 832 js.Pointer(&ret), js.Pointer(&exception), 833 callback.Ref(), 834 ) 835 836 return 837 } 838 839 // HasFuncOffSpeak returns true if the function "WEBEXT.ttsEngine.onSpeak.removeListener" exists. 840 func HasFuncOffSpeak() bool { 841 return js.True == bindings.HasFuncOffSpeak() 842 } 843 844 // FuncOffSpeak returns the function "WEBEXT.ttsEngine.onSpeak.removeListener". 845 func FuncOffSpeak() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])])]) { 846 bindings.FuncOffSpeak( 847 js.Pointer(&fn), 848 ) 849 return 850 } 851 852 // OffSpeak calls the function "WEBEXT.ttsEngine.onSpeak.removeListener" directly. 853 func OffSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret js.Void) { 854 bindings.CallOffSpeak( 855 js.Pointer(&ret), 856 callback.Ref(), 857 ) 858 859 return 860 } 861 862 // TryOffSpeak calls the function "WEBEXT.ttsEngine.onSpeak.removeListener" 863 // in a try/catch block and returns (_, err, ok = false) when it went through 864 // the catch clause. 865 func TryOffSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret js.Void, exception js.Any, ok bool) { 866 ok = js.True == bindings.TryOffSpeak( 867 js.Pointer(&ret), js.Pointer(&exception), 868 callback.Ref(), 869 ) 870 871 return 872 } 873 874 // HasFuncHasOnSpeak returns true if the function "WEBEXT.ttsEngine.onSpeak.hasListener" exists. 875 func HasFuncHasOnSpeak() bool { 876 return js.True == bindings.HasFuncHasOnSpeak() 877 } 878 879 // FuncHasOnSpeak returns the function "WEBEXT.ttsEngine.onSpeak.hasListener". 880 func FuncHasOnSpeak() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) bool]) { 881 bindings.FuncHasOnSpeak( 882 js.Pointer(&fn), 883 ) 884 return 885 } 886 887 // HasOnSpeak calls the function "WEBEXT.ttsEngine.onSpeak.hasListener" directly. 888 func HasOnSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret bool) { 889 bindings.CallHasOnSpeak( 890 js.Pointer(&ret), 891 callback.Ref(), 892 ) 893 894 return 895 } 896 897 // TryHasOnSpeak calls the function "WEBEXT.ttsEngine.onSpeak.hasListener" 898 // in a try/catch block and returns (_, err, ok = false) when it went through 899 // the catch clause. 900 func TryHasOnSpeak(callback js.Func[func(utterance js.String, options *SpeakOptions, sendTtsEvent js.Func[func(event *tts.TtsEvent)])]) (ret bool, exception js.Any, ok bool) { 901 ok = js.True == bindings.TryHasOnSpeak( 902 js.Pointer(&ret), js.Pointer(&exception), 903 callback.Ref(), 904 ) 905 906 return 907 } 908 909 type OnSpeakWithAudioStreamEventCallbackFunc func(this js.Ref, utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)]) js.Ref 910 911 func (fn OnSpeakWithAudioStreamEventCallbackFunc) Register() js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])] { 912 return js.RegisterCallback[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]( 913 fn, abi.FuncPCABIInternal(fn), 914 ) 915 } 916 917 func (fn OnSpeakWithAudioStreamEventCallbackFunc) DispatchCallback( 918 targetPC uintptr, ctx *js.CallbackContext, 919 ) { 920 args := ctx.Args() 921 if len(args) != 5+1 /* js this */ || 922 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 923 js.ThrowInvalidCallbackInvocation() 924 } 925 var arg1 SpeakOptions 926 arg1.UpdateFrom(args[1+1]) 927 defer arg1.FreeMembers(true) 928 var arg2 AudioStreamOptions 929 arg2.UpdateFrom(args[2+1]) 930 defer arg2.FreeMembers(true) 931 932 if ctx.Return(fn( 933 args[0], 934 935 js.String{}.FromRef(args[0+1]), 936 mark.NoEscape(&arg1), 937 mark.NoEscape(&arg2), 938 js.Func[func(audioBufferParams *AudioBuffer)]{}.FromRef(args[3+1]), 939 js.Func[func(errorMessage js.String)]{}.FromRef(args[4+1]), 940 )) { 941 return 942 } 943 944 js.ThrowCallbackValueNotReturned() 945 } 946 947 type OnSpeakWithAudioStreamEventCallback[T any] struct { 948 Fn func(arg T, this js.Ref, utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)]) js.Ref 949 Arg T 950 } 951 952 func (cb *OnSpeakWithAudioStreamEventCallback[T]) Register() js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])] { 953 return js.RegisterCallback[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]( 954 cb, abi.FuncPCABIInternal(cb.Fn), 955 ) 956 } 957 958 func (cb *OnSpeakWithAudioStreamEventCallback[T]) DispatchCallback( 959 targetPC uintptr, ctx *js.CallbackContext, 960 ) { 961 args := ctx.Args() 962 if len(args) != 5+1 /* js this */ || 963 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 964 js.ThrowInvalidCallbackInvocation() 965 } 966 var arg1 SpeakOptions 967 arg1.UpdateFrom(args[1+1]) 968 defer arg1.FreeMembers(true) 969 var arg2 AudioStreamOptions 970 arg2.UpdateFrom(args[2+1]) 971 defer arg2.FreeMembers(true) 972 973 if ctx.Return(cb.Fn( 974 cb.Arg, 975 args[0], 976 977 js.String{}.FromRef(args[0+1]), 978 mark.NoEscape(&arg1), 979 mark.NoEscape(&arg2), 980 js.Func[func(audioBufferParams *AudioBuffer)]{}.FromRef(args[3+1]), 981 js.Func[func(errorMessage js.String)]{}.FromRef(args[4+1]), 982 )) { 983 return 984 } 985 986 js.ThrowCallbackValueNotReturned() 987 } 988 989 // HasFuncOnSpeakWithAudioStream returns true if the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.addListener" exists. 990 func HasFuncOnSpeakWithAudioStream() bool { 991 return js.True == bindings.HasFuncOnSpeakWithAudioStream() 992 } 993 994 // FuncOnSpeakWithAudioStream returns the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.addListener". 995 func FuncOnSpeakWithAudioStream() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])])]) { 996 bindings.FuncOnSpeakWithAudioStream( 997 js.Pointer(&fn), 998 ) 999 return 1000 } 1001 1002 // OnSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.addListener" directly. 1003 func OnSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret js.Void) { 1004 bindings.CallOnSpeakWithAudioStream( 1005 js.Pointer(&ret), 1006 callback.Ref(), 1007 ) 1008 1009 return 1010 } 1011 1012 // TryOnSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.addListener" 1013 // in a try/catch block and returns (_, err, ok = false) when it went through 1014 // the catch clause. 1015 func TryOnSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret js.Void, exception js.Any, ok bool) { 1016 ok = js.True == bindings.TryOnSpeakWithAudioStream( 1017 js.Pointer(&ret), js.Pointer(&exception), 1018 callback.Ref(), 1019 ) 1020 1021 return 1022 } 1023 1024 // HasFuncOffSpeakWithAudioStream returns true if the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.removeListener" exists. 1025 func HasFuncOffSpeakWithAudioStream() bool { 1026 return js.True == bindings.HasFuncOffSpeakWithAudioStream() 1027 } 1028 1029 // FuncOffSpeakWithAudioStream returns the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.removeListener". 1030 func FuncOffSpeakWithAudioStream() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])])]) { 1031 bindings.FuncOffSpeakWithAudioStream( 1032 js.Pointer(&fn), 1033 ) 1034 return 1035 } 1036 1037 // OffSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.removeListener" directly. 1038 func OffSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret js.Void) { 1039 bindings.CallOffSpeakWithAudioStream( 1040 js.Pointer(&ret), 1041 callback.Ref(), 1042 ) 1043 1044 return 1045 } 1046 1047 // TryOffSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.removeListener" 1048 // in a try/catch block and returns (_, err, ok = false) when it went through 1049 // the catch clause. 1050 func TryOffSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret js.Void, exception js.Any, ok bool) { 1051 ok = js.True == bindings.TryOffSpeakWithAudioStream( 1052 js.Pointer(&ret), js.Pointer(&exception), 1053 callback.Ref(), 1054 ) 1055 1056 return 1057 } 1058 1059 // HasFuncHasOnSpeakWithAudioStream returns true if the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.hasListener" exists. 1060 func HasFuncHasOnSpeakWithAudioStream() bool { 1061 return js.True == bindings.HasFuncHasOnSpeakWithAudioStream() 1062 } 1063 1064 // FuncHasOnSpeakWithAudioStream returns the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.hasListener". 1065 func FuncHasOnSpeakWithAudioStream() (fn js.Func[func(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) bool]) { 1066 bindings.FuncHasOnSpeakWithAudioStream( 1067 js.Pointer(&fn), 1068 ) 1069 return 1070 } 1071 1072 // HasOnSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.hasListener" directly. 1073 func HasOnSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret bool) { 1074 bindings.CallHasOnSpeakWithAudioStream( 1075 js.Pointer(&ret), 1076 callback.Ref(), 1077 ) 1078 1079 return 1080 } 1081 1082 // TryHasOnSpeakWithAudioStream calls the function "WEBEXT.ttsEngine.onSpeakWithAudioStream.hasListener" 1083 // in a try/catch block and returns (_, err, ok = false) when it went through 1084 // the catch clause. 1085 func TryHasOnSpeakWithAudioStream(callback js.Func[func(utterance js.String, options *SpeakOptions, audioStreamOptions *AudioStreamOptions, sendTtsAudio js.Func[func(audioBufferParams *AudioBuffer)], sendError js.Func[func(errorMessage js.String)])]) (ret bool, exception js.Any, ok bool) { 1086 ok = js.True == bindings.TryHasOnSpeakWithAudioStream( 1087 js.Pointer(&ret), js.Pointer(&exception), 1088 callback.Ref(), 1089 ) 1090 1091 return 1092 } 1093 1094 type OnStopEventCallbackFunc func(this js.Ref) js.Ref 1095 1096 func (fn OnStopEventCallbackFunc) Register() js.Func[func()] { 1097 return js.RegisterCallback[func()]( 1098 fn, abi.FuncPCABIInternal(fn), 1099 ) 1100 } 1101 1102 func (fn OnStopEventCallbackFunc) DispatchCallback( 1103 targetPC uintptr, ctx *js.CallbackContext, 1104 ) { 1105 args := ctx.Args() 1106 if len(args) != 0+1 /* js this */ || 1107 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1108 js.ThrowInvalidCallbackInvocation() 1109 } 1110 1111 if ctx.Return(fn( 1112 args[0], 1113 )) { 1114 return 1115 } 1116 1117 js.ThrowCallbackValueNotReturned() 1118 } 1119 1120 type OnStopEventCallback[T any] struct { 1121 Fn func(arg T, this js.Ref) js.Ref 1122 Arg T 1123 } 1124 1125 func (cb *OnStopEventCallback[T]) Register() js.Func[func()] { 1126 return js.RegisterCallback[func()]( 1127 cb, abi.FuncPCABIInternal(cb.Fn), 1128 ) 1129 } 1130 1131 func (cb *OnStopEventCallback[T]) DispatchCallback( 1132 targetPC uintptr, ctx *js.CallbackContext, 1133 ) { 1134 args := ctx.Args() 1135 if len(args) != 0+1 /* js this */ || 1136 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1137 js.ThrowInvalidCallbackInvocation() 1138 } 1139 1140 if ctx.Return(cb.Fn( 1141 cb.Arg, 1142 args[0], 1143 )) { 1144 return 1145 } 1146 1147 js.ThrowCallbackValueNotReturned() 1148 } 1149 1150 // HasFuncOnStop returns true if the function "WEBEXT.ttsEngine.onStop.addListener" exists. 1151 func HasFuncOnStop() bool { 1152 return js.True == bindings.HasFuncOnStop() 1153 } 1154 1155 // FuncOnStop returns the function "WEBEXT.ttsEngine.onStop.addListener". 1156 func FuncOnStop() (fn js.Func[func(callback js.Func[func()])]) { 1157 bindings.FuncOnStop( 1158 js.Pointer(&fn), 1159 ) 1160 return 1161 } 1162 1163 // OnStop calls the function "WEBEXT.ttsEngine.onStop.addListener" directly. 1164 func OnStop(callback js.Func[func()]) (ret js.Void) { 1165 bindings.CallOnStop( 1166 js.Pointer(&ret), 1167 callback.Ref(), 1168 ) 1169 1170 return 1171 } 1172 1173 // TryOnStop calls the function "WEBEXT.ttsEngine.onStop.addListener" 1174 // in a try/catch block and returns (_, err, ok = false) when it went through 1175 // the catch clause. 1176 func TryOnStop(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 1177 ok = js.True == bindings.TryOnStop( 1178 js.Pointer(&ret), js.Pointer(&exception), 1179 callback.Ref(), 1180 ) 1181 1182 return 1183 } 1184 1185 // HasFuncOffStop returns true if the function "WEBEXT.ttsEngine.onStop.removeListener" exists. 1186 func HasFuncOffStop() bool { 1187 return js.True == bindings.HasFuncOffStop() 1188 } 1189 1190 // FuncOffStop returns the function "WEBEXT.ttsEngine.onStop.removeListener". 1191 func FuncOffStop() (fn js.Func[func(callback js.Func[func()])]) { 1192 bindings.FuncOffStop( 1193 js.Pointer(&fn), 1194 ) 1195 return 1196 } 1197 1198 // OffStop calls the function "WEBEXT.ttsEngine.onStop.removeListener" directly. 1199 func OffStop(callback js.Func[func()]) (ret js.Void) { 1200 bindings.CallOffStop( 1201 js.Pointer(&ret), 1202 callback.Ref(), 1203 ) 1204 1205 return 1206 } 1207 1208 // TryOffStop calls the function "WEBEXT.ttsEngine.onStop.removeListener" 1209 // in a try/catch block and returns (_, err, ok = false) when it went through 1210 // the catch clause. 1211 func TryOffStop(callback js.Func[func()]) (ret js.Void, exception js.Any, ok bool) { 1212 ok = js.True == bindings.TryOffStop( 1213 js.Pointer(&ret), js.Pointer(&exception), 1214 callback.Ref(), 1215 ) 1216 1217 return 1218 } 1219 1220 // HasFuncHasOnStop returns true if the function "WEBEXT.ttsEngine.onStop.hasListener" exists. 1221 func HasFuncHasOnStop() bool { 1222 return js.True == bindings.HasFuncHasOnStop() 1223 } 1224 1225 // FuncHasOnStop returns the function "WEBEXT.ttsEngine.onStop.hasListener". 1226 func FuncHasOnStop() (fn js.Func[func(callback js.Func[func()]) bool]) { 1227 bindings.FuncHasOnStop( 1228 js.Pointer(&fn), 1229 ) 1230 return 1231 } 1232 1233 // HasOnStop calls the function "WEBEXT.ttsEngine.onStop.hasListener" directly. 1234 func HasOnStop(callback js.Func[func()]) (ret bool) { 1235 bindings.CallHasOnStop( 1236 js.Pointer(&ret), 1237 callback.Ref(), 1238 ) 1239 1240 return 1241 } 1242 1243 // TryHasOnStop calls the function "WEBEXT.ttsEngine.onStop.hasListener" 1244 // in a try/catch block and returns (_, err, ok = false) when it went through 1245 // the catch clause. 1246 func TryHasOnStop(callback js.Func[func()]) (ret bool, exception js.Any, ok bool) { 1247 ok = js.True == bindings.TryHasOnStop( 1248 js.Pointer(&ret), js.Pointer(&exception), 1249 callback.Ref(), 1250 ) 1251 1252 return 1253 } 1254 1255 // HasFuncSendTtsAudio returns true if the function "WEBEXT.ttsEngine.sendTtsAudio" exists. 1256 func HasFuncSendTtsAudio() bool { 1257 return js.True == bindings.HasFuncSendTtsAudio() 1258 } 1259 1260 // FuncSendTtsAudio returns the function "WEBEXT.ttsEngine.sendTtsAudio". 1261 func FuncSendTtsAudio() (fn js.Func[func(requestId int64, audio AudioBuffer)]) { 1262 bindings.FuncSendTtsAudio( 1263 js.Pointer(&fn), 1264 ) 1265 return 1266 } 1267 1268 // SendTtsAudio calls the function "WEBEXT.ttsEngine.sendTtsAudio" directly. 1269 func SendTtsAudio(requestId int64, audio AudioBuffer) (ret js.Void) { 1270 bindings.CallSendTtsAudio( 1271 js.Pointer(&ret), 1272 float64(requestId), 1273 js.Pointer(&audio), 1274 ) 1275 1276 return 1277 } 1278 1279 // TrySendTtsAudio calls the function "WEBEXT.ttsEngine.sendTtsAudio" 1280 // in a try/catch block and returns (_, err, ok = false) when it went through 1281 // the catch clause. 1282 func TrySendTtsAudio(requestId int64, audio AudioBuffer) (ret js.Void, exception js.Any, ok bool) { 1283 ok = js.True == bindings.TrySendTtsAudio( 1284 js.Pointer(&ret), js.Pointer(&exception), 1285 float64(requestId), 1286 js.Pointer(&audio), 1287 ) 1288 1289 return 1290 } 1291 1292 // HasFuncSendTtsEvent returns true if the function "WEBEXT.ttsEngine.sendTtsEvent" exists. 1293 func HasFuncSendTtsEvent() bool { 1294 return js.True == bindings.HasFuncSendTtsEvent() 1295 } 1296 1297 // FuncSendTtsEvent returns the function "WEBEXT.ttsEngine.sendTtsEvent". 1298 func FuncSendTtsEvent() (fn js.Func[func(requestId int64, event tts.TtsEvent)]) { 1299 bindings.FuncSendTtsEvent( 1300 js.Pointer(&fn), 1301 ) 1302 return 1303 } 1304 1305 // SendTtsEvent calls the function "WEBEXT.ttsEngine.sendTtsEvent" directly. 1306 func SendTtsEvent(requestId int64, event tts.TtsEvent) (ret js.Void) { 1307 bindings.CallSendTtsEvent( 1308 js.Pointer(&ret), 1309 float64(requestId), 1310 js.Pointer(&event), 1311 ) 1312 1313 return 1314 } 1315 1316 // TrySendTtsEvent calls the function "WEBEXT.ttsEngine.sendTtsEvent" 1317 // in a try/catch block and returns (_, err, ok = false) when it went through 1318 // the catch clause. 1319 func TrySendTtsEvent(requestId int64, event tts.TtsEvent) (ret js.Void, exception js.Any, ok bool) { 1320 ok = js.True == bindings.TrySendTtsEvent( 1321 js.Pointer(&ret), js.Pointer(&exception), 1322 float64(requestId), 1323 js.Pointer(&event), 1324 ) 1325 1326 return 1327 } 1328 1329 // HasFuncUpdateVoices returns true if the function "WEBEXT.ttsEngine.updateVoices" exists. 1330 func HasFuncUpdateVoices() bool { 1331 return js.True == bindings.HasFuncUpdateVoices() 1332 } 1333 1334 // FuncUpdateVoices returns the function "WEBEXT.ttsEngine.updateVoices". 1335 func FuncUpdateVoices() (fn js.Func[func(voices js.Array[tts.TtsVoice])]) { 1336 bindings.FuncUpdateVoices( 1337 js.Pointer(&fn), 1338 ) 1339 return 1340 } 1341 1342 // UpdateVoices calls the function "WEBEXT.ttsEngine.updateVoices" directly. 1343 func UpdateVoices(voices js.Array[tts.TtsVoice]) (ret js.Void) { 1344 bindings.CallUpdateVoices( 1345 js.Pointer(&ret), 1346 voices.Ref(), 1347 ) 1348 1349 return 1350 } 1351 1352 // TryUpdateVoices calls the function "WEBEXT.ttsEngine.updateVoices" 1353 // in a try/catch block and returns (_, err, ok = false) when it went through 1354 // the catch clause. 1355 func TryUpdateVoices(voices js.Array[tts.TtsVoice]) (ret js.Void, exception js.Any, ok bool) { 1356 ok = js.True == bindings.TryUpdateVoices( 1357 js.Pointer(&ret), js.Pointer(&exception), 1358 voices.Ref(), 1359 ) 1360 1361 return 1362 }