github.com/primecitizens/pcz/std@v0.2.1/plat/js/web/apis29_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package web 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/web/bindings" 11 ) 12 13 type FlowControlType uint32 14 15 const ( 16 _ FlowControlType = iota 17 18 FlowControlType_NONE 19 FlowControlType_HARDWARE 20 ) 21 22 func (FlowControlType) FromRef(str js.Ref) FlowControlType { 23 return FlowControlType(bindings.ConstOfFlowControlType(str)) 24 } 25 26 func (x FlowControlType) String() (string, bool) { 27 switch x { 28 case FlowControlType_NONE: 29 return "none", true 30 case FlowControlType_HARDWARE: 31 return "hardware", true 32 default: 33 return "", false 34 } 35 } 36 37 type SerialOptions struct { 38 // BaudRate is "SerialOptions.baudRate" 39 // 40 // Required 41 BaudRate uint32 42 // DataBits is "SerialOptions.dataBits" 43 // 44 // Optional, defaults to 8. 45 // 46 // NOTE: FFI_USE_DataBits MUST be set to true to make this field effective. 47 DataBits uint8 48 // StopBits is "SerialOptions.stopBits" 49 // 50 // Optional, defaults to 1. 51 // 52 // NOTE: FFI_USE_StopBits MUST be set to true to make this field effective. 53 StopBits uint8 54 // Parity is "SerialOptions.parity" 55 // 56 // Optional, defaults to "none". 57 Parity ParityType 58 // BufferSize is "SerialOptions.bufferSize" 59 // 60 // Optional, defaults to 255. 61 // 62 // NOTE: FFI_USE_BufferSize MUST be set to true to make this field effective. 63 BufferSize uint32 64 // FlowControl is "SerialOptions.flowControl" 65 // 66 // Optional, defaults to "none". 67 FlowControl FlowControlType 68 69 FFI_USE_DataBits bool // for DataBits. 70 FFI_USE_StopBits bool // for StopBits. 71 FFI_USE_BufferSize bool // for BufferSize. 72 73 FFI_USE bool 74 } 75 76 // FromRef calls UpdateFrom and returns a SerialOptions with all fields set. 77 func (p SerialOptions) FromRef(ref js.Ref) SerialOptions { 78 p.UpdateFrom(ref) 79 return p 80 } 81 82 // New creates a new SerialOptions in the application heap. 83 func (p SerialOptions) New() js.Ref { 84 return bindings.SerialOptionsJSLoad( 85 js.Pointer(&p), js.True, 0, 86 ) 87 } 88 89 // UpdateFrom copies value of all fields of the heap object to p. 90 func (p *SerialOptions) UpdateFrom(ref js.Ref) { 91 bindings.SerialOptionsJSStore( 92 js.Pointer(p), ref, 93 ) 94 } 95 96 // Update writes all fields of the p to the heap object referenced by ref. 97 func (p *SerialOptions) Update(ref js.Ref) { 98 bindings.SerialOptionsJSLoad( 99 js.Pointer(p), js.False, ref, 100 ) 101 } 102 103 // FreeMembers frees fields with heap reference, if recursive is true 104 // free all heap references reachable from p. 105 func (p *SerialOptions) FreeMembers(recursive bool) { 106 } 107 108 type SerialOutputSignals struct { 109 // DataTerminalReady is "SerialOutputSignals.dataTerminalReady" 110 // 111 // Optional 112 // 113 // NOTE: FFI_USE_DataTerminalReady MUST be set to true to make this field effective. 114 DataTerminalReady bool 115 // RequestToSend is "SerialOutputSignals.requestToSend" 116 // 117 // Optional 118 // 119 // NOTE: FFI_USE_RequestToSend MUST be set to true to make this field effective. 120 RequestToSend bool 121 // Break is "SerialOutputSignals.break" 122 // 123 // Optional 124 // 125 // NOTE: FFI_USE_Break MUST be set to true to make this field effective. 126 Break bool 127 128 FFI_USE_DataTerminalReady bool // for DataTerminalReady. 129 FFI_USE_RequestToSend bool // for RequestToSend. 130 FFI_USE_Break bool // for Break. 131 132 FFI_USE bool 133 } 134 135 // FromRef calls UpdateFrom and returns a SerialOutputSignals with all fields set. 136 func (p SerialOutputSignals) FromRef(ref js.Ref) SerialOutputSignals { 137 p.UpdateFrom(ref) 138 return p 139 } 140 141 // New creates a new SerialOutputSignals in the application heap. 142 func (p SerialOutputSignals) New() js.Ref { 143 return bindings.SerialOutputSignalsJSLoad( 144 js.Pointer(&p), js.True, 0, 145 ) 146 } 147 148 // UpdateFrom copies value of all fields of the heap object to p. 149 func (p *SerialOutputSignals) UpdateFrom(ref js.Ref) { 150 bindings.SerialOutputSignalsJSStore( 151 js.Pointer(p), ref, 152 ) 153 } 154 155 // Update writes all fields of the p to the heap object referenced by ref. 156 func (p *SerialOutputSignals) Update(ref js.Ref) { 157 bindings.SerialOutputSignalsJSLoad( 158 js.Pointer(p), js.False, ref, 159 ) 160 } 161 162 // FreeMembers frees fields with heap reference, if recursive is true 163 // free all heap references reachable from p. 164 func (p *SerialOutputSignals) FreeMembers(recursive bool) { 165 } 166 167 type SerialInputSignals struct { 168 // DataCarrierDetect is "SerialInputSignals.dataCarrierDetect" 169 // 170 // Required 171 DataCarrierDetect bool 172 // ClearToSend is "SerialInputSignals.clearToSend" 173 // 174 // Required 175 ClearToSend bool 176 // RingIndicator is "SerialInputSignals.ringIndicator" 177 // 178 // Required 179 RingIndicator bool 180 // DataSetReady is "SerialInputSignals.dataSetReady" 181 // 182 // Required 183 DataSetReady bool 184 185 FFI_USE bool 186 } 187 188 // FromRef calls UpdateFrom and returns a SerialInputSignals with all fields set. 189 func (p SerialInputSignals) FromRef(ref js.Ref) SerialInputSignals { 190 p.UpdateFrom(ref) 191 return p 192 } 193 194 // New creates a new SerialInputSignals in the application heap. 195 func (p SerialInputSignals) New() js.Ref { 196 return bindings.SerialInputSignalsJSLoad( 197 js.Pointer(&p), js.True, 0, 198 ) 199 } 200 201 // UpdateFrom copies value of all fields of the heap object to p. 202 func (p *SerialInputSignals) UpdateFrom(ref js.Ref) { 203 bindings.SerialInputSignalsJSStore( 204 js.Pointer(p), ref, 205 ) 206 } 207 208 // Update writes all fields of the p to the heap object referenced by ref. 209 func (p *SerialInputSignals) Update(ref js.Ref) { 210 bindings.SerialInputSignalsJSLoad( 211 js.Pointer(p), js.False, ref, 212 ) 213 } 214 215 // FreeMembers frees fields with heap reference, if recursive is true 216 // free all heap references reachable from p. 217 func (p *SerialInputSignals) FreeMembers(recursive bool) { 218 } 219 220 type SerialPort struct { 221 EventTarget 222 } 223 224 func (this SerialPort) Once() SerialPort { 225 this.ref.Once() 226 return this 227 } 228 229 func (this SerialPort) Ref() js.Ref { 230 return this.EventTarget.Ref() 231 } 232 233 func (this SerialPort) FromRef(ref js.Ref) SerialPort { 234 this.EventTarget = this.EventTarget.FromRef(ref) 235 return this 236 } 237 238 func (this SerialPort) Free() { 239 this.ref.Free() 240 } 241 242 // Readable returns the value of property "SerialPort.readable". 243 // 244 // It returns ok=false if there is no such property. 245 func (this SerialPort) Readable() (ret ReadableStream, ok bool) { 246 ok = js.True == bindings.GetSerialPortReadable( 247 this.ref, js.Pointer(&ret), 248 ) 249 return 250 } 251 252 // Writable returns the value of property "SerialPort.writable". 253 // 254 // It returns ok=false if there is no such property. 255 func (this SerialPort) Writable() (ret WritableStream, ok bool) { 256 ok = js.True == bindings.GetSerialPortWritable( 257 this.ref, js.Pointer(&ret), 258 ) 259 return 260 } 261 262 // HasFuncGetInfo returns true if the method "SerialPort.getInfo" exists. 263 func (this SerialPort) HasFuncGetInfo() bool { 264 return js.True == bindings.HasFuncSerialPortGetInfo( 265 this.ref, 266 ) 267 } 268 269 // FuncGetInfo returns the method "SerialPort.getInfo". 270 func (this SerialPort) FuncGetInfo() (fn js.Func[func() SerialPortInfo]) { 271 bindings.FuncSerialPortGetInfo( 272 this.ref, js.Pointer(&fn), 273 ) 274 return 275 } 276 277 // GetInfo calls the method "SerialPort.getInfo". 278 func (this SerialPort) GetInfo() (ret SerialPortInfo) { 279 bindings.CallSerialPortGetInfo( 280 this.ref, js.Pointer(&ret), 281 ) 282 283 return 284 } 285 286 // TryGetInfo calls the method "SerialPort.getInfo" 287 // in a try/catch block and returns (_, err, ok = false) when it went through 288 // the catch clause. 289 func (this SerialPort) TryGetInfo() (ret SerialPortInfo, exception js.Any, ok bool) { 290 ok = js.True == bindings.TrySerialPortGetInfo( 291 this.ref, js.Pointer(&ret), js.Pointer(&exception), 292 ) 293 294 return 295 } 296 297 // HasFuncOpen returns true if the method "SerialPort.open" exists. 298 func (this SerialPort) HasFuncOpen() bool { 299 return js.True == bindings.HasFuncSerialPortOpen( 300 this.ref, 301 ) 302 } 303 304 // FuncOpen returns the method "SerialPort.open". 305 func (this SerialPort) FuncOpen() (fn js.Func[func(options SerialOptions) js.Promise[js.Void]]) { 306 bindings.FuncSerialPortOpen( 307 this.ref, js.Pointer(&fn), 308 ) 309 return 310 } 311 312 // Open calls the method "SerialPort.open". 313 func (this SerialPort) Open(options SerialOptions) (ret js.Promise[js.Void]) { 314 bindings.CallSerialPortOpen( 315 this.ref, js.Pointer(&ret), 316 js.Pointer(&options), 317 ) 318 319 return 320 } 321 322 // TryOpen calls the method "SerialPort.open" 323 // in a try/catch block and returns (_, err, ok = false) when it went through 324 // the catch clause. 325 func (this SerialPort) TryOpen(options SerialOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 326 ok = js.True == bindings.TrySerialPortOpen( 327 this.ref, js.Pointer(&ret), js.Pointer(&exception), 328 js.Pointer(&options), 329 ) 330 331 return 332 } 333 334 // HasFuncSetSignals returns true if the method "SerialPort.setSignals" exists. 335 func (this SerialPort) HasFuncSetSignals() bool { 336 return js.True == bindings.HasFuncSerialPortSetSignals( 337 this.ref, 338 ) 339 } 340 341 // FuncSetSignals returns the method "SerialPort.setSignals". 342 func (this SerialPort) FuncSetSignals() (fn js.Func[func(signals SerialOutputSignals) js.Promise[js.Void]]) { 343 bindings.FuncSerialPortSetSignals( 344 this.ref, js.Pointer(&fn), 345 ) 346 return 347 } 348 349 // SetSignals calls the method "SerialPort.setSignals". 350 func (this SerialPort) SetSignals(signals SerialOutputSignals) (ret js.Promise[js.Void]) { 351 bindings.CallSerialPortSetSignals( 352 this.ref, js.Pointer(&ret), 353 js.Pointer(&signals), 354 ) 355 356 return 357 } 358 359 // TrySetSignals calls the method "SerialPort.setSignals" 360 // in a try/catch block and returns (_, err, ok = false) when it went through 361 // the catch clause. 362 func (this SerialPort) TrySetSignals(signals SerialOutputSignals) (ret js.Promise[js.Void], exception js.Any, ok bool) { 363 ok = js.True == bindings.TrySerialPortSetSignals( 364 this.ref, js.Pointer(&ret), js.Pointer(&exception), 365 js.Pointer(&signals), 366 ) 367 368 return 369 } 370 371 // HasFuncSetSignals1 returns true if the method "SerialPort.setSignals" exists. 372 func (this SerialPort) HasFuncSetSignals1() bool { 373 return js.True == bindings.HasFuncSerialPortSetSignals1( 374 this.ref, 375 ) 376 } 377 378 // FuncSetSignals1 returns the method "SerialPort.setSignals". 379 func (this SerialPort) FuncSetSignals1() (fn js.Func[func() js.Promise[js.Void]]) { 380 bindings.FuncSerialPortSetSignals1( 381 this.ref, js.Pointer(&fn), 382 ) 383 return 384 } 385 386 // SetSignals1 calls the method "SerialPort.setSignals". 387 func (this SerialPort) SetSignals1() (ret js.Promise[js.Void]) { 388 bindings.CallSerialPortSetSignals1( 389 this.ref, js.Pointer(&ret), 390 ) 391 392 return 393 } 394 395 // TrySetSignals1 calls the method "SerialPort.setSignals" 396 // in a try/catch block and returns (_, err, ok = false) when it went through 397 // the catch clause. 398 func (this SerialPort) TrySetSignals1() (ret js.Promise[js.Void], exception js.Any, ok bool) { 399 ok = js.True == bindings.TrySerialPortSetSignals1( 400 this.ref, js.Pointer(&ret), js.Pointer(&exception), 401 ) 402 403 return 404 } 405 406 // HasFuncGetSignals returns true if the method "SerialPort.getSignals" exists. 407 func (this SerialPort) HasFuncGetSignals() bool { 408 return js.True == bindings.HasFuncSerialPortGetSignals( 409 this.ref, 410 ) 411 } 412 413 // FuncGetSignals returns the method "SerialPort.getSignals". 414 func (this SerialPort) FuncGetSignals() (fn js.Func[func() js.Promise[SerialInputSignals]]) { 415 bindings.FuncSerialPortGetSignals( 416 this.ref, js.Pointer(&fn), 417 ) 418 return 419 } 420 421 // GetSignals calls the method "SerialPort.getSignals". 422 func (this SerialPort) GetSignals() (ret js.Promise[SerialInputSignals]) { 423 bindings.CallSerialPortGetSignals( 424 this.ref, js.Pointer(&ret), 425 ) 426 427 return 428 } 429 430 // TryGetSignals calls the method "SerialPort.getSignals" 431 // in a try/catch block and returns (_, err, ok = false) when it went through 432 // the catch clause. 433 func (this SerialPort) TryGetSignals() (ret js.Promise[SerialInputSignals], exception js.Any, ok bool) { 434 ok = js.True == bindings.TrySerialPortGetSignals( 435 this.ref, js.Pointer(&ret), js.Pointer(&exception), 436 ) 437 438 return 439 } 440 441 // HasFuncClose returns true if the method "SerialPort.close" exists. 442 func (this SerialPort) HasFuncClose() bool { 443 return js.True == bindings.HasFuncSerialPortClose( 444 this.ref, 445 ) 446 } 447 448 // FuncClose returns the method "SerialPort.close". 449 func (this SerialPort) FuncClose() (fn js.Func[func() js.Promise[js.Void]]) { 450 bindings.FuncSerialPortClose( 451 this.ref, js.Pointer(&fn), 452 ) 453 return 454 } 455 456 // Close calls the method "SerialPort.close". 457 func (this SerialPort) Close() (ret js.Promise[js.Void]) { 458 bindings.CallSerialPortClose( 459 this.ref, js.Pointer(&ret), 460 ) 461 462 return 463 } 464 465 // TryClose calls the method "SerialPort.close" 466 // in a try/catch block and returns (_, err, ok = false) when it went through 467 // the catch clause. 468 func (this SerialPort) TryClose() (ret js.Promise[js.Void], exception js.Any, ok bool) { 469 ok = js.True == bindings.TrySerialPortClose( 470 this.ref, js.Pointer(&ret), js.Pointer(&exception), 471 ) 472 473 return 474 } 475 476 // HasFuncForget returns true if the method "SerialPort.forget" exists. 477 func (this SerialPort) HasFuncForget() bool { 478 return js.True == bindings.HasFuncSerialPortForget( 479 this.ref, 480 ) 481 } 482 483 // FuncForget returns the method "SerialPort.forget". 484 func (this SerialPort) FuncForget() (fn js.Func[func() js.Promise[js.Void]]) { 485 bindings.FuncSerialPortForget( 486 this.ref, js.Pointer(&fn), 487 ) 488 return 489 } 490 491 // Forget calls the method "SerialPort.forget". 492 func (this SerialPort) Forget() (ret js.Promise[js.Void]) { 493 bindings.CallSerialPortForget( 494 this.ref, js.Pointer(&ret), 495 ) 496 497 return 498 } 499 500 // TryForget calls the method "SerialPort.forget" 501 // in a try/catch block and returns (_, err, ok = false) when it went through 502 // the catch clause. 503 func (this SerialPort) TryForget() (ret js.Promise[js.Void], exception js.Any, ok bool) { 504 ok = js.True == bindings.TrySerialPortForget( 505 this.ref, js.Pointer(&ret), js.Pointer(&exception), 506 ) 507 508 return 509 } 510 511 type SerialPortFilter struct { 512 // UsbVendorId is "SerialPortFilter.usbVendorId" 513 // 514 // Optional 515 // 516 // NOTE: FFI_USE_UsbVendorId MUST be set to true to make this field effective. 517 UsbVendorId uint16 518 // UsbProductId is "SerialPortFilter.usbProductId" 519 // 520 // Optional 521 // 522 // NOTE: FFI_USE_UsbProductId MUST be set to true to make this field effective. 523 UsbProductId uint16 524 // BluetoothServiceClassId is "SerialPortFilter.bluetoothServiceClassId" 525 // 526 // Optional 527 BluetoothServiceClassId BluetoothServiceUUID 528 529 FFI_USE_UsbVendorId bool // for UsbVendorId. 530 FFI_USE_UsbProductId bool // for UsbProductId. 531 532 FFI_USE bool 533 } 534 535 // FromRef calls UpdateFrom and returns a SerialPortFilter with all fields set. 536 func (p SerialPortFilter) FromRef(ref js.Ref) SerialPortFilter { 537 p.UpdateFrom(ref) 538 return p 539 } 540 541 // New creates a new SerialPortFilter in the application heap. 542 func (p SerialPortFilter) New() js.Ref { 543 return bindings.SerialPortFilterJSLoad( 544 js.Pointer(&p), js.True, 0, 545 ) 546 } 547 548 // UpdateFrom copies value of all fields of the heap object to p. 549 func (p *SerialPortFilter) UpdateFrom(ref js.Ref) { 550 bindings.SerialPortFilterJSStore( 551 js.Pointer(p), ref, 552 ) 553 } 554 555 // Update writes all fields of the p to the heap object referenced by ref. 556 func (p *SerialPortFilter) Update(ref js.Ref) { 557 bindings.SerialPortFilterJSLoad( 558 js.Pointer(p), js.False, ref, 559 ) 560 } 561 562 // FreeMembers frees fields with heap reference, if recursive is true 563 // free all heap references reachable from p. 564 func (p *SerialPortFilter) FreeMembers(recursive bool) { 565 js.Free( 566 p.BluetoothServiceClassId.Ref(), 567 ) 568 p.BluetoothServiceClassId = p.BluetoothServiceClassId.FromRef(js.Undefined) 569 } 570 571 type SerialPortRequestOptions struct { 572 // Filters is "SerialPortRequestOptions.filters" 573 // 574 // Optional 575 Filters js.Array[SerialPortFilter] 576 // AllowedBluetoothServiceClassIds is "SerialPortRequestOptions.allowedBluetoothServiceClassIds" 577 // 578 // Optional 579 AllowedBluetoothServiceClassIds js.Array[BluetoothServiceUUID] 580 581 FFI_USE bool 582 } 583 584 // FromRef calls UpdateFrom and returns a SerialPortRequestOptions with all fields set. 585 func (p SerialPortRequestOptions) FromRef(ref js.Ref) SerialPortRequestOptions { 586 p.UpdateFrom(ref) 587 return p 588 } 589 590 // New creates a new SerialPortRequestOptions in the application heap. 591 func (p SerialPortRequestOptions) New() js.Ref { 592 return bindings.SerialPortRequestOptionsJSLoad( 593 js.Pointer(&p), js.True, 0, 594 ) 595 } 596 597 // UpdateFrom copies value of all fields of the heap object to p. 598 func (p *SerialPortRequestOptions) UpdateFrom(ref js.Ref) { 599 bindings.SerialPortRequestOptionsJSStore( 600 js.Pointer(p), ref, 601 ) 602 } 603 604 // Update writes all fields of the p to the heap object referenced by ref. 605 func (p *SerialPortRequestOptions) Update(ref js.Ref) { 606 bindings.SerialPortRequestOptionsJSLoad( 607 js.Pointer(p), js.False, ref, 608 ) 609 } 610 611 // FreeMembers frees fields with heap reference, if recursive is true 612 // free all heap references reachable from p. 613 func (p *SerialPortRequestOptions) FreeMembers(recursive bool) { 614 js.Free( 615 p.Filters.Ref(), 616 p.AllowedBluetoothServiceClassIds.Ref(), 617 ) 618 p.Filters = p.Filters.FromRef(js.Undefined) 619 p.AllowedBluetoothServiceClassIds = p.AllowedBluetoothServiceClassIds.FromRef(js.Undefined) 620 } 621 622 type Serial struct { 623 EventTarget 624 } 625 626 func (this Serial) Once() Serial { 627 this.ref.Once() 628 return this 629 } 630 631 func (this Serial) Ref() js.Ref { 632 return this.EventTarget.Ref() 633 } 634 635 func (this Serial) FromRef(ref js.Ref) Serial { 636 this.EventTarget = this.EventTarget.FromRef(ref) 637 return this 638 } 639 640 func (this Serial) Free() { 641 this.ref.Free() 642 } 643 644 // HasFuncGetPorts returns true if the method "Serial.getPorts" exists. 645 func (this Serial) HasFuncGetPorts() bool { 646 return js.True == bindings.HasFuncSerialGetPorts( 647 this.ref, 648 ) 649 } 650 651 // FuncGetPorts returns the method "Serial.getPorts". 652 func (this Serial) FuncGetPorts() (fn js.Func[func() js.Promise[js.Array[SerialPort]]]) { 653 bindings.FuncSerialGetPorts( 654 this.ref, js.Pointer(&fn), 655 ) 656 return 657 } 658 659 // GetPorts calls the method "Serial.getPorts". 660 func (this Serial) GetPorts() (ret js.Promise[js.Array[SerialPort]]) { 661 bindings.CallSerialGetPorts( 662 this.ref, js.Pointer(&ret), 663 ) 664 665 return 666 } 667 668 // TryGetPorts calls the method "Serial.getPorts" 669 // in a try/catch block and returns (_, err, ok = false) when it went through 670 // the catch clause. 671 func (this Serial) TryGetPorts() (ret js.Promise[js.Array[SerialPort]], exception js.Any, ok bool) { 672 ok = js.True == bindings.TrySerialGetPorts( 673 this.ref, js.Pointer(&ret), js.Pointer(&exception), 674 ) 675 676 return 677 } 678 679 // HasFuncRequestPort returns true if the method "Serial.requestPort" exists. 680 func (this Serial) HasFuncRequestPort() bool { 681 return js.True == bindings.HasFuncSerialRequestPort( 682 this.ref, 683 ) 684 } 685 686 // FuncRequestPort returns the method "Serial.requestPort". 687 func (this Serial) FuncRequestPort() (fn js.Func[func(options SerialPortRequestOptions) js.Promise[SerialPort]]) { 688 bindings.FuncSerialRequestPort( 689 this.ref, js.Pointer(&fn), 690 ) 691 return 692 } 693 694 // RequestPort calls the method "Serial.requestPort". 695 func (this Serial) RequestPort(options SerialPortRequestOptions) (ret js.Promise[SerialPort]) { 696 bindings.CallSerialRequestPort( 697 this.ref, js.Pointer(&ret), 698 js.Pointer(&options), 699 ) 700 701 return 702 } 703 704 // TryRequestPort calls the method "Serial.requestPort" 705 // in a try/catch block and returns (_, err, ok = false) when it went through 706 // the catch clause. 707 func (this Serial) TryRequestPort(options SerialPortRequestOptions) (ret js.Promise[SerialPort], exception js.Any, ok bool) { 708 ok = js.True == bindings.TrySerialRequestPort( 709 this.ref, js.Pointer(&ret), js.Pointer(&exception), 710 js.Pointer(&options), 711 ) 712 713 return 714 } 715 716 // HasFuncRequestPort1 returns true if the method "Serial.requestPort" exists. 717 func (this Serial) HasFuncRequestPort1() bool { 718 return js.True == bindings.HasFuncSerialRequestPort1( 719 this.ref, 720 ) 721 } 722 723 // FuncRequestPort1 returns the method "Serial.requestPort". 724 func (this Serial) FuncRequestPort1() (fn js.Func[func() js.Promise[SerialPort]]) { 725 bindings.FuncSerialRequestPort1( 726 this.ref, js.Pointer(&fn), 727 ) 728 return 729 } 730 731 // RequestPort1 calls the method "Serial.requestPort". 732 func (this Serial) RequestPort1() (ret js.Promise[SerialPort]) { 733 bindings.CallSerialRequestPort1( 734 this.ref, js.Pointer(&ret), 735 ) 736 737 return 738 } 739 740 // TryRequestPort1 calls the method "Serial.requestPort" 741 // in a try/catch block and returns (_, err, ok = false) when it went through 742 // the catch clause. 743 func (this Serial) TryRequestPort1() (ret js.Promise[SerialPort], exception js.Any, ok bool) { 744 ok = js.True == bindings.TrySerialRequestPort1( 745 this.ref, js.Pointer(&ret), js.Pointer(&exception), 746 ) 747 748 return 749 } 750 751 type MediaDecodingType uint32 752 753 const ( 754 _ MediaDecodingType = iota 755 756 MediaDecodingType_FILE 757 MediaDecodingType_MEDIA_SOURCE 758 MediaDecodingType_WEBRTC 759 ) 760 761 func (MediaDecodingType) FromRef(str js.Ref) MediaDecodingType { 762 return MediaDecodingType(bindings.ConstOfMediaDecodingType(str)) 763 } 764 765 func (x MediaDecodingType) String() (string, bool) { 766 switch x { 767 case MediaDecodingType_FILE: 768 return "file", true 769 case MediaDecodingType_MEDIA_SOURCE: 770 return "media-source", true 771 case MediaDecodingType_WEBRTC: 772 return "webrtc", true 773 default: 774 return "", false 775 } 776 } 777 778 type KeySystemTrackConfiguration struct { 779 // Robustness is "KeySystemTrackConfiguration.robustness" 780 // 781 // Optional, defaults to "". 782 Robustness js.String 783 // EncryptionScheme is "KeySystemTrackConfiguration.encryptionScheme" 784 // 785 // Optional, defaults to null. 786 EncryptionScheme js.String 787 788 FFI_USE bool 789 } 790 791 // FromRef calls UpdateFrom and returns a KeySystemTrackConfiguration with all fields set. 792 func (p KeySystemTrackConfiguration) FromRef(ref js.Ref) KeySystemTrackConfiguration { 793 p.UpdateFrom(ref) 794 return p 795 } 796 797 // New creates a new KeySystemTrackConfiguration in the application heap. 798 func (p KeySystemTrackConfiguration) New() js.Ref { 799 return bindings.KeySystemTrackConfigurationJSLoad( 800 js.Pointer(&p), js.True, 0, 801 ) 802 } 803 804 // UpdateFrom copies value of all fields of the heap object to p. 805 func (p *KeySystemTrackConfiguration) UpdateFrom(ref js.Ref) { 806 bindings.KeySystemTrackConfigurationJSStore( 807 js.Pointer(p), ref, 808 ) 809 } 810 811 // Update writes all fields of the p to the heap object referenced by ref. 812 func (p *KeySystemTrackConfiguration) Update(ref js.Ref) { 813 bindings.KeySystemTrackConfigurationJSLoad( 814 js.Pointer(p), js.False, ref, 815 ) 816 } 817 818 // FreeMembers frees fields with heap reference, if recursive is true 819 // free all heap references reachable from p. 820 func (p *KeySystemTrackConfiguration) FreeMembers(recursive bool) { 821 js.Free( 822 p.Robustness.Ref(), 823 p.EncryptionScheme.Ref(), 824 ) 825 p.Robustness = p.Robustness.FromRef(js.Undefined) 826 p.EncryptionScheme = p.EncryptionScheme.FromRef(js.Undefined) 827 } 828 829 type MediaCapabilitiesKeySystemConfiguration struct { 830 // KeySystem is "MediaCapabilitiesKeySystemConfiguration.keySystem" 831 // 832 // Required 833 KeySystem js.String 834 // InitDataType is "MediaCapabilitiesKeySystemConfiguration.initDataType" 835 // 836 // Optional, defaults to "". 837 InitDataType js.String 838 // DistinctiveIdentifier is "MediaCapabilitiesKeySystemConfiguration.distinctiveIdentifier" 839 // 840 // Optional, defaults to "optional". 841 DistinctiveIdentifier MediaKeysRequirement 842 // PersistentState is "MediaCapabilitiesKeySystemConfiguration.persistentState" 843 // 844 // Optional, defaults to "optional". 845 PersistentState MediaKeysRequirement 846 // SessionTypes is "MediaCapabilitiesKeySystemConfiguration.sessionTypes" 847 // 848 // Optional 849 SessionTypes js.Array[js.String] 850 // Audio is "MediaCapabilitiesKeySystemConfiguration.audio" 851 // 852 // Optional 853 // 854 // NOTE: Audio.FFI_USE MUST be set to true to get Audio used. 855 Audio KeySystemTrackConfiguration 856 // Video is "MediaCapabilitiesKeySystemConfiguration.video" 857 // 858 // Optional 859 // 860 // NOTE: Video.FFI_USE MUST be set to true to get Video used. 861 Video KeySystemTrackConfiguration 862 863 FFI_USE bool 864 } 865 866 // FromRef calls UpdateFrom and returns a MediaCapabilitiesKeySystemConfiguration with all fields set. 867 func (p MediaCapabilitiesKeySystemConfiguration) FromRef(ref js.Ref) MediaCapabilitiesKeySystemConfiguration { 868 p.UpdateFrom(ref) 869 return p 870 } 871 872 // New creates a new MediaCapabilitiesKeySystemConfiguration in the application heap. 873 func (p MediaCapabilitiesKeySystemConfiguration) New() js.Ref { 874 return bindings.MediaCapabilitiesKeySystemConfigurationJSLoad( 875 js.Pointer(&p), js.True, 0, 876 ) 877 } 878 879 // UpdateFrom copies value of all fields of the heap object to p. 880 func (p *MediaCapabilitiesKeySystemConfiguration) UpdateFrom(ref js.Ref) { 881 bindings.MediaCapabilitiesKeySystemConfigurationJSStore( 882 js.Pointer(p), ref, 883 ) 884 } 885 886 // Update writes all fields of the p to the heap object referenced by ref. 887 func (p *MediaCapabilitiesKeySystemConfiguration) Update(ref js.Ref) { 888 bindings.MediaCapabilitiesKeySystemConfigurationJSLoad( 889 js.Pointer(p), js.False, ref, 890 ) 891 } 892 893 // FreeMembers frees fields with heap reference, if recursive is true 894 // free all heap references reachable from p. 895 func (p *MediaCapabilitiesKeySystemConfiguration) FreeMembers(recursive bool) { 896 js.Free( 897 p.KeySystem.Ref(), 898 p.InitDataType.Ref(), 899 p.SessionTypes.Ref(), 900 ) 901 p.KeySystem = p.KeySystem.FromRef(js.Undefined) 902 p.InitDataType = p.InitDataType.FromRef(js.Undefined) 903 p.SessionTypes = p.SessionTypes.FromRef(js.Undefined) 904 if recursive { 905 p.Audio.FreeMembers(true) 906 p.Video.FreeMembers(true) 907 } 908 } 909 910 type HdrMetadataType uint32 911 912 const ( 913 _ HdrMetadataType = iota 914 915 HdrMetadataType_SMPTE_ST2086 916 HdrMetadataType_SMPTE_ST2094_10 917 HdrMetadataType_SMPTE_ST2094_40 918 ) 919 920 func (HdrMetadataType) FromRef(str js.Ref) HdrMetadataType { 921 return HdrMetadataType(bindings.ConstOfHdrMetadataType(str)) 922 } 923 924 func (x HdrMetadataType) String() (string, bool) { 925 switch x { 926 case HdrMetadataType_SMPTE_ST2086: 927 return "smpteSt2086", true 928 case HdrMetadataType_SMPTE_ST2094_10: 929 return "smpteSt2094-10", true 930 case HdrMetadataType_SMPTE_ST2094_40: 931 return "smpteSt2094-40", true 932 default: 933 return "", false 934 } 935 } 936 937 type TransferFunction uint32 938 939 const ( 940 _ TransferFunction = iota 941 942 TransferFunction_SRGB 943 TransferFunction_PQ 944 TransferFunction_HLG 945 ) 946 947 func (TransferFunction) FromRef(str js.Ref) TransferFunction { 948 return TransferFunction(bindings.ConstOfTransferFunction(str)) 949 } 950 951 func (x TransferFunction) String() (string, bool) { 952 switch x { 953 case TransferFunction_SRGB: 954 return "srgb", true 955 case TransferFunction_PQ: 956 return "pq", true 957 case TransferFunction_HLG: 958 return "hlg", true 959 default: 960 return "", false 961 } 962 } 963 964 type VideoConfiguration struct { 965 // ContentType is "VideoConfiguration.contentType" 966 // 967 // Required 968 ContentType js.String 969 // Width is "VideoConfiguration.width" 970 // 971 // Required 972 Width uint32 973 // Height is "VideoConfiguration.height" 974 // 975 // Required 976 Height uint32 977 // Bitrate is "VideoConfiguration.bitrate" 978 // 979 // Required 980 Bitrate uint64 981 // Framerate is "VideoConfiguration.framerate" 982 // 983 // Required 984 Framerate float64 985 // HasAlphaChannel is "VideoConfiguration.hasAlphaChannel" 986 // 987 // Optional 988 // 989 // NOTE: FFI_USE_HasAlphaChannel MUST be set to true to make this field effective. 990 HasAlphaChannel bool 991 // HdrMetadataType is "VideoConfiguration.hdrMetadataType" 992 // 993 // Optional 994 HdrMetadataType HdrMetadataType 995 // ColorGamut is "VideoConfiguration.colorGamut" 996 // 997 // Optional 998 ColorGamut ColorGamut 999 // TransferFunction is "VideoConfiguration.transferFunction" 1000 // 1001 // Optional 1002 TransferFunction TransferFunction 1003 // ScalabilityMode is "VideoConfiguration.scalabilityMode" 1004 // 1005 // Optional 1006 ScalabilityMode js.String 1007 // SpatialScalability is "VideoConfiguration.spatialScalability" 1008 // 1009 // Optional 1010 // 1011 // NOTE: FFI_USE_SpatialScalability MUST be set to true to make this field effective. 1012 SpatialScalability bool 1013 1014 FFI_USE_HasAlphaChannel bool // for HasAlphaChannel. 1015 FFI_USE_SpatialScalability bool // for SpatialScalability. 1016 1017 FFI_USE bool 1018 } 1019 1020 // FromRef calls UpdateFrom and returns a VideoConfiguration with all fields set. 1021 func (p VideoConfiguration) FromRef(ref js.Ref) VideoConfiguration { 1022 p.UpdateFrom(ref) 1023 return p 1024 } 1025 1026 // New creates a new VideoConfiguration in the application heap. 1027 func (p VideoConfiguration) New() js.Ref { 1028 return bindings.VideoConfigurationJSLoad( 1029 js.Pointer(&p), js.True, 0, 1030 ) 1031 } 1032 1033 // UpdateFrom copies value of all fields of the heap object to p. 1034 func (p *VideoConfiguration) UpdateFrom(ref js.Ref) { 1035 bindings.VideoConfigurationJSStore( 1036 js.Pointer(p), ref, 1037 ) 1038 } 1039 1040 // Update writes all fields of the p to the heap object referenced by ref. 1041 func (p *VideoConfiguration) Update(ref js.Ref) { 1042 bindings.VideoConfigurationJSLoad( 1043 js.Pointer(p), js.False, ref, 1044 ) 1045 } 1046 1047 // FreeMembers frees fields with heap reference, if recursive is true 1048 // free all heap references reachable from p. 1049 func (p *VideoConfiguration) FreeMembers(recursive bool) { 1050 js.Free( 1051 p.ContentType.Ref(), 1052 p.ScalabilityMode.Ref(), 1053 ) 1054 p.ContentType = p.ContentType.FromRef(js.Undefined) 1055 p.ScalabilityMode = p.ScalabilityMode.FromRef(js.Undefined) 1056 } 1057 1058 type MediaDecodingConfiguration struct { 1059 // Type is "MediaDecodingConfiguration.type" 1060 // 1061 // Required 1062 Type MediaDecodingType 1063 // KeySystemConfiguration is "MediaDecodingConfiguration.keySystemConfiguration" 1064 // 1065 // Optional 1066 // 1067 // NOTE: KeySystemConfiguration.FFI_USE MUST be set to true to get KeySystemConfiguration used. 1068 KeySystemConfiguration MediaCapabilitiesKeySystemConfiguration 1069 // Video is "MediaDecodingConfiguration.video" 1070 // 1071 // Optional 1072 // 1073 // NOTE: Video.FFI_USE MUST be set to true to get Video used. 1074 Video VideoConfiguration 1075 // Audio is "MediaDecodingConfiguration.audio" 1076 // 1077 // Optional 1078 // 1079 // NOTE: Audio.FFI_USE MUST be set to true to get Audio used. 1080 Audio AudioConfiguration 1081 1082 FFI_USE bool 1083 } 1084 1085 // FromRef calls UpdateFrom and returns a MediaDecodingConfiguration with all fields set. 1086 func (p MediaDecodingConfiguration) FromRef(ref js.Ref) MediaDecodingConfiguration { 1087 p.UpdateFrom(ref) 1088 return p 1089 } 1090 1091 // New creates a new MediaDecodingConfiguration in the application heap. 1092 func (p MediaDecodingConfiguration) New() js.Ref { 1093 return bindings.MediaDecodingConfigurationJSLoad( 1094 js.Pointer(&p), js.True, 0, 1095 ) 1096 } 1097 1098 // UpdateFrom copies value of all fields of the heap object to p. 1099 func (p *MediaDecodingConfiguration) UpdateFrom(ref js.Ref) { 1100 bindings.MediaDecodingConfigurationJSStore( 1101 js.Pointer(p), ref, 1102 ) 1103 } 1104 1105 // Update writes all fields of the p to the heap object referenced by ref. 1106 func (p *MediaDecodingConfiguration) Update(ref js.Ref) { 1107 bindings.MediaDecodingConfigurationJSLoad( 1108 js.Pointer(p), js.False, ref, 1109 ) 1110 } 1111 1112 // FreeMembers frees fields with heap reference, if recursive is true 1113 // free all heap references reachable from p. 1114 func (p *MediaDecodingConfiguration) FreeMembers(recursive bool) { 1115 if recursive { 1116 p.KeySystemConfiguration.FreeMembers(true) 1117 p.Video.FreeMembers(true) 1118 p.Audio.FreeMembers(true) 1119 } 1120 } 1121 1122 type MediaCapabilitiesDecodingInfo struct { 1123 // KeySystemAccess is "MediaCapabilitiesDecodingInfo.keySystemAccess" 1124 // 1125 // Required 1126 KeySystemAccess MediaKeySystemAccess 1127 // Configuration is "MediaCapabilitiesDecodingInfo.configuration" 1128 // 1129 // Optional 1130 // 1131 // NOTE: Configuration.FFI_USE MUST be set to true to get Configuration used. 1132 Configuration MediaDecodingConfiguration 1133 // Supported is "MediaCapabilitiesDecodingInfo.supported" 1134 // 1135 // Required 1136 Supported bool 1137 // Smooth is "MediaCapabilitiesDecodingInfo.smooth" 1138 // 1139 // Required 1140 Smooth bool 1141 // PowerEfficient is "MediaCapabilitiesDecodingInfo.powerEfficient" 1142 // 1143 // Required 1144 PowerEfficient bool 1145 1146 FFI_USE bool 1147 } 1148 1149 // FromRef calls UpdateFrom and returns a MediaCapabilitiesDecodingInfo with all fields set. 1150 func (p MediaCapabilitiesDecodingInfo) FromRef(ref js.Ref) MediaCapabilitiesDecodingInfo { 1151 p.UpdateFrom(ref) 1152 return p 1153 } 1154 1155 // New creates a new MediaCapabilitiesDecodingInfo in the application heap. 1156 func (p MediaCapabilitiesDecodingInfo) New() js.Ref { 1157 return bindings.MediaCapabilitiesDecodingInfoJSLoad( 1158 js.Pointer(&p), js.True, 0, 1159 ) 1160 } 1161 1162 // UpdateFrom copies value of all fields of the heap object to p. 1163 func (p *MediaCapabilitiesDecodingInfo) UpdateFrom(ref js.Ref) { 1164 bindings.MediaCapabilitiesDecodingInfoJSStore( 1165 js.Pointer(p), ref, 1166 ) 1167 } 1168 1169 // Update writes all fields of the p to the heap object referenced by ref. 1170 func (p *MediaCapabilitiesDecodingInfo) Update(ref js.Ref) { 1171 bindings.MediaCapabilitiesDecodingInfoJSLoad( 1172 js.Pointer(p), js.False, ref, 1173 ) 1174 } 1175 1176 // FreeMembers frees fields with heap reference, if recursive is true 1177 // free all heap references reachable from p. 1178 func (p *MediaCapabilitiesDecodingInfo) FreeMembers(recursive bool) { 1179 js.Free( 1180 p.KeySystemAccess.Ref(), 1181 ) 1182 p.KeySystemAccess = p.KeySystemAccess.FromRef(js.Undefined) 1183 if recursive { 1184 p.Configuration.FreeMembers(true) 1185 } 1186 } 1187 1188 type MediaEncodingType uint32 1189 1190 const ( 1191 _ MediaEncodingType = iota 1192 1193 MediaEncodingType_RECORD 1194 MediaEncodingType_WEBRTC 1195 ) 1196 1197 func (MediaEncodingType) FromRef(str js.Ref) MediaEncodingType { 1198 return MediaEncodingType(bindings.ConstOfMediaEncodingType(str)) 1199 } 1200 1201 func (x MediaEncodingType) String() (string, bool) { 1202 switch x { 1203 case MediaEncodingType_RECORD: 1204 return "record", true 1205 case MediaEncodingType_WEBRTC: 1206 return "webrtc", true 1207 default: 1208 return "", false 1209 } 1210 } 1211 1212 type MediaEncodingConfiguration struct { 1213 // Type is "MediaEncodingConfiguration.type" 1214 // 1215 // Required 1216 Type MediaEncodingType 1217 // Video is "MediaEncodingConfiguration.video" 1218 // 1219 // Optional 1220 // 1221 // NOTE: Video.FFI_USE MUST be set to true to get Video used. 1222 Video VideoConfiguration 1223 // Audio is "MediaEncodingConfiguration.audio" 1224 // 1225 // Optional 1226 // 1227 // NOTE: Audio.FFI_USE MUST be set to true to get Audio used. 1228 Audio AudioConfiguration 1229 1230 FFI_USE bool 1231 } 1232 1233 // FromRef calls UpdateFrom and returns a MediaEncodingConfiguration with all fields set. 1234 func (p MediaEncodingConfiguration) FromRef(ref js.Ref) MediaEncodingConfiguration { 1235 p.UpdateFrom(ref) 1236 return p 1237 } 1238 1239 // New creates a new MediaEncodingConfiguration in the application heap. 1240 func (p MediaEncodingConfiguration) New() js.Ref { 1241 return bindings.MediaEncodingConfigurationJSLoad( 1242 js.Pointer(&p), js.True, 0, 1243 ) 1244 } 1245 1246 // UpdateFrom copies value of all fields of the heap object to p. 1247 func (p *MediaEncodingConfiguration) UpdateFrom(ref js.Ref) { 1248 bindings.MediaEncodingConfigurationJSStore( 1249 js.Pointer(p), ref, 1250 ) 1251 } 1252 1253 // Update writes all fields of the p to the heap object referenced by ref. 1254 func (p *MediaEncodingConfiguration) Update(ref js.Ref) { 1255 bindings.MediaEncodingConfigurationJSLoad( 1256 js.Pointer(p), js.False, ref, 1257 ) 1258 } 1259 1260 // FreeMembers frees fields with heap reference, if recursive is true 1261 // free all heap references reachable from p. 1262 func (p *MediaEncodingConfiguration) FreeMembers(recursive bool) { 1263 if recursive { 1264 p.Video.FreeMembers(true) 1265 p.Audio.FreeMembers(true) 1266 } 1267 } 1268 1269 type MediaCapabilitiesEncodingInfo struct { 1270 // Configuration is "MediaCapabilitiesEncodingInfo.configuration" 1271 // 1272 // Optional 1273 // 1274 // NOTE: Configuration.FFI_USE MUST be set to true to get Configuration used. 1275 Configuration MediaEncodingConfiguration 1276 // Supported is "MediaCapabilitiesEncodingInfo.supported" 1277 // 1278 // Required 1279 Supported bool 1280 // Smooth is "MediaCapabilitiesEncodingInfo.smooth" 1281 // 1282 // Required 1283 Smooth bool 1284 // PowerEfficient is "MediaCapabilitiesEncodingInfo.powerEfficient" 1285 // 1286 // Required 1287 PowerEfficient bool 1288 1289 FFI_USE bool 1290 } 1291 1292 // FromRef calls UpdateFrom and returns a MediaCapabilitiesEncodingInfo with all fields set. 1293 func (p MediaCapabilitiesEncodingInfo) FromRef(ref js.Ref) MediaCapabilitiesEncodingInfo { 1294 p.UpdateFrom(ref) 1295 return p 1296 } 1297 1298 // New creates a new MediaCapabilitiesEncodingInfo in the application heap. 1299 func (p MediaCapabilitiesEncodingInfo) New() js.Ref { 1300 return bindings.MediaCapabilitiesEncodingInfoJSLoad( 1301 js.Pointer(&p), js.True, 0, 1302 ) 1303 } 1304 1305 // UpdateFrom copies value of all fields of the heap object to p. 1306 func (p *MediaCapabilitiesEncodingInfo) UpdateFrom(ref js.Ref) { 1307 bindings.MediaCapabilitiesEncodingInfoJSStore( 1308 js.Pointer(p), ref, 1309 ) 1310 } 1311 1312 // Update writes all fields of the p to the heap object referenced by ref. 1313 func (p *MediaCapabilitiesEncodingInfo) Update(ref js.Ref) { 1314 bindings.MediaCapabilitiesEncodingInfoJSLoad( 1315 js.Pointer(p), js.False, ref, 1316 ) 1317 } 1318 1319 // FreeMembers frees fields with heap reference, if recursive is true 1320 // free all heap references reachable from p. 1321 func (p *MediaCapabilitiesEncodingInfo) FreeMembers(recursive bool) { 1322 if recursive { 1323 p.Configuration.FreeMembers(true) 1324 } 1325 } 1326 1327 type MediaCapabilities struct { 1328 ref js.Ref 1329 } 1330 1331 func (this MediaCapabilities) Once() MediaCapabilities { 1332 this.ref.Once() 1333 return this 1334 } 1335 1336 func (this MediaCapabilities) Ref() js.Ref { 1337 return this.ref 1338 } 1339 1340 func (this MediaCapabilities) FromRef(ref js.Ref) MediaCapabilities { 1341 this.ref = ref 1342 return this 1343 } 1344 1345 func (this MediaCapabilities) Free() { 1346 this.ref.Free() 1347 } 1348 1349 // HasFuncDecodingInfo returns true if the method "MediaCapabilities.decodingInfo" exists. 1350 func (this MediaCapabilities) HasFuncDecodingInfo() bool { 1351 return js.True == bindings.HasFuncMediaCapabilitiesDecodingInfo( 1352 this.ref, 1353 ) 1354 } 1355 1356 // FuncDecodingInfo returns the method "MediaCapabilities.decodingInfo". 1357 func (this MediaCapabilities) FuncDecodingInfo() (fn js.Func[func(configuration MediaDecodingConfiguration) js.Promise[MediaCapabilitiesDecodingInfo]]) { 1358 bindings.FuncMediaCapabilitiesDecodingInfo( 1359 this.ref, js.Pointer(&fn), 1360 ) 1361 return 1362 } 1363 1364 // DecodingInfo calls the method "MediaCapabilities.decodingInfo". 1365 func (this MediaCapabilities) DecodingInfo(configuration MediaDecodingConfiguration) (ret js.Promise[MediaCapabilitiesDecodingInfo]) { 1366 bindings.CallMediaCapabilitiesDecodingInfo( 1367 this.ref, js.Pointer(&ret), 1368 js.Pointer(&configuration), 1369 ) 1370 1371 return 1372 } 1373 1374 // TryDecodingInfo calls the method "MediaCapabilities.decodingInfo" 1375 // in a try/catch block and returns (_, err, ok = false) when it went through 1376 // the catch clause. 1377 func (this MediaCapabilities) TryDecodingInfo(configuration MediaDecodingConfiguration) (ret js.Promise[MediaCapabilitiesDecodingInfo], exception js.Any, ok bool) { 1378 ok = js.True == bindings.TryMediaCapabilitiesDecodingInfo( 1379 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1380 js.Pointer(&configuration), 1381 ) 1382 1383 return 1384 } 1385 1386 // HasFuncEncodingInfo returns true if the method "MediaCapabilities.encodingInfo" exists. 1387 func (this MediaCapabilities) HasFuncEncodingInfo() bool { 1388 return js.True == bindings.HasFuncMediaCapabilitiesEncodingInfo( 1389 this.ref, 1390 ) 1391 } 1392 1393 // FuncEncodingInfo returns the method "MediaCapabilities.encodingInfo". 1394 func (this MediaCapabilities) FuncEncodingInfo() (fn js.Func[func(configuration MediaEncodingConfiguration) js.Promise[MediaCapabilitiesEncodingInfo]]) { 1395 bindings.FuncMediaCapabilitiesEncodingInfo( 1396 this.ref, js.Pointer(&fn), 1397 ) 1398 return 1399 } 1400 1401 // EncodingInfo calls the method "MediaCapabilities.encodingInfo". 1402 func (this MediaCapabilities) EncodingInfo(configuration MediaEncodingConfiguration) (ret js.Promise[MediaCapabilitiesEncodingInfo]) { 1403 bindings.CallMediaCapabilitiesEncodingInfo( 1404 this.ref, js.Pointer(&ret), 1405 js.Pointer(&configuration), 1406 ) 1407 1408 return 1409 } 1410 1411 // TryEncodingInfo calls the method "MediaCapabilities.encodingInfo" 1412 // in a try/catch block and returns (_, err, ok = false) when it went through 1413 // the catch clause. 1414 func (this MediaCapabilities) TryEncodingInfo(configuration MediaEncodingConfiguration) (ret js.Promise[MediaCapabilitiesEncodingInfo], exception js.Any, ok bool) { 1415 ok = js.True == bindings.TryMediaCapabilitiesEncodingInfo( 1416 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1417 js.Pointer(&configuration), 1418 ) 1419 1420 return 1421 } 1422 1423 type UserActivation struct { 1424 ref js.Ref 1425 } 1426 1427 func (this UserActivation) Once() UserActivation { 1428 this.ref.Once() 1429 return this 1430 } 1431 1432 func (this UserActivation) Ref() js.Ref { 1433 return this.ref 1434 } 1435 1436 func (this UserActivation) FromRef(ref js.Ref) UserActivation { 1437 this.ref = ref 1438 return this 1439 } 1440 1441 func (this UserActivation) Free() { 1442 this.ref.Free() 1443 } 1444 1445 // HasBeenActive returns the value of property "UserActivation.hasBeenActive". 1446 // 1447 // It returns ok=false if there is no such property. 1448 func (this UserActivation) HasBeenActive() (ret bool, ok bool) { 1449 ok = js.True == bindings.GetUserActivationHasBeenActive( 1450 this.ref, js.Pointer(&ret), 1451 ) 1452 return 1453 } 1454 1455 // IsActive returns the value of property "UserActivation.isActive". 1456 // 1457 // It returns ok=false if there is no such property. 1458 func (this UserActivation) IsActive() (ret bool, ok bool) { 1459 ok = js.True == bindings.GetUserActivationIsActive( 1460 this.ref, js.Pointer(&ret), 1461 ) 1462 return 1463 } 1464 1465 type PermissionStatus struct { 1466 EventTarget 1467 } 1468 1469 func (this PermissionStatus) Once() PermissionStatus { 1470 this.ref.Once() 1471 return this 1472 } 1473 1474 func (this PermissionStatus) Ref() js.Ref { 1475 return this.EventTarget.Ref() 1476 } 1477 1478 func (this PermissionStatus) FromRef(ref js.Ref) PermissionStatus { 1479 this.EventTarget = this.EventTarget.FromRef(ref) 1480 return this 1481 } 1482 1483 func (this PermissionStatus) Free() { 1484 this.ref.Free() 1485 } 1486 1487 // State returns the value of property "PermissionStatus.state". 1488 // 1489 // It returns ok=false if there is no such property. 1490 func (this PermissionStatus) State() (ret PermissionState, ok bool) { 1491 ok = js.True == bindings.GetPermissionStatusState( 1492 this.ref, js.Pointer(&ret), 1493 ) 1494 return 1495 } 1496 1497 // Name returns the value of property "PermissionStatus.name". 1498 // 1499 // It returns ok=false if there is no such property. 1500 func (this PermissionStatus) Name() (ret js.String, ok bool) { 1501 ok = js.True == bindings.GetPermissionStatusName( 1502 this.ref, js.Pointer(&ret), 1503 ) 1504 return 1505 } 1506 1507 type Permissions struct { 1508 ref js.Ref 1509 } 1510 1511 func (this Permissions) Once() Permissions { 1512 this.ref.Once() 1513 return this 1514 } 1515 1516 func (this Permissions) Ref() js.Ref { 1517 return this.ref 1518 } 1519 1520 func (this Permissions) FromRef(ref js.Ref) Permissions { 1521 this.ref = ref 1522 return this 1523 } 1524 1525 func (this Permissions) Free() { 1526 this.ref.Free() 1527 } 1528 1529 // HasFuncQuery returns true if the method "Permissions.query" exists. 1530 func (this Permissions) HasFuncQuery() bool { 1531 return js.True == bindings.HasFuncPermissionsQuery( 1532 this.ref, 1533 ) 1534 } 1535 1536 // FuncQuery returns the method "Permissions.query". 1537 func (this Permissions) FuncQuery() (fn js.Func[func(permissionDesc js.Object) js.Promise[PermissionStatus]]) { 1538 bindings.FuncPermissionsQuery( 1539 this.ref, js.Pointer(&fn), 1540 ) 1541 return 1542 } 1543 1544 // Query calls the method "Permissions.query". 1545 func (this Permissions) Query(permissionDesc js.Object) (ret js.Promise[PermissionStatus]) { 1546 bindings.CallPermissionsQuery( 1547 this.ref, js.Pointer(&ret), 1548 permissionDesc.Ref(), 1549 ) 1550 1551 return 1552 } 1553 1554 // TryQuery calls the method "Permissions.query" 1555 // in a try/catch block and returns (_, err, ok = false) when it went through 1556 // the catch clause. 1557 func (this Permissions) TryQuery(permissionDesc js.Object) (ret js.Promise[PermissionStatus], exception js.Any, ok bool) { 1558 ok = js.True == bindings.TryPermissionsQuery( 1559 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1560 permissionDesc.Ref(), 1561 ) 1562 1563 return 1564 } 1565 1566 // HasFuncRevoke returns true if the method "Permissions.revoke" exists. 1567 func (this Permissions) HasFuncRevoke() bool { 1568 return js.True == bindings.HasFuncPermissionsRevoke( 1569 this.ref, 1570 ) 1571 } 1572 1573 // FuncRevoke returns the method "Permissions.revoke". 1574 func (this Permissions) FuncRevoke() (fn js.Func[func(permissionDesc js.Object) js.Promise[PermissionStatus]]) { 1575 bindings.FuncPermissionsRevoke( 1576 this.ref, js.Pointer(&fn), 1577 ) 1578 return 1579 } 1580 1581 // Revoke calls the method "Permissions.revoke". 1582 func (this Permissions) Revoke(permissionDesc js.Object) (ret js.Promise[PermissionStatus]) { 1583 bindings.CallPermissionsRevoke( 1584 this.ref, js.Pointer(&ret), 1585 permissionDesc.Ref(), 1586 ) 1587 1588 return 1589 } 1590 1591 // TryRevoke calls the method "Permissions.revoke" 1592 // in a try/catch block and returns (_, err, ok = false) when it went through 1593 // the catch clause. 1594 func (this Permissions) TryRevoke(permissionDesc js.Object) (ret js.Promise[PermissionStatus], exception js.Any, ok bool) { 1595 ok = js.True == bindings.TryPermissionsRevoke( 1596 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1597 permissionDesc.Ref(), 1598 ) 1599 1600 return 1601 } 1602 1603 // HasFuncRequest returns true if the method "Permissions.request" exists. 1604 func (this Permissions) HasFuncRequest() bool { 1605 return js.True == bindings.HasFuncPermissionsRequest( 1606 this.ref, 1607 ) 1608 } 1609 1610 // FuncRequest returns the method "Permissions.request". 1611 func (this Permissions) FuncRequest() (fn js.Func[func(permissionDesc js.Object) js.Promise[PermissionStatus]]) { 1612 bindings.FuncPermissionsRequest( 1613 this.ref, js.Pointer(&fn), 1614 ) 1615 return 1616 } 1617 1618 // Request calls the method "Permissions.request". 1619 func (this Permissions) Request(permissionDesc js.Object) (ret js.Promise[PermissionStatus]) { 1620 bindings.CallPermissionsRequest( 1621 this.ref, js.Pointer(&ret), 1622 permissionDesc.Ref(), 1623 ) 1624 1625 return 1626 } 1627 1628 // TryRequest calls the method "Permissions.request" 1629 // in a try/catch block and returns (_, err, ok = false) when it went through 1630 // the catch clause. 1631 func (this Permissions) TryRequest(permissionDesc js.Object) (ret js.Promise[PermissionStatus], exception js.Any, ok bool) { 1632 ok = js.True == bindings.TryPermissionsRequest( 1633 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1634 permissionDesc.Ref(), 1635 ) 1636 1637 return 1638 } 1639 1640 type ContactProperty uint32 1641 1642 const ( 1643 _ ContactProperty = iota 1644 1645 ContactProperty_ADDRESS 1646 ContactProperty_EMAIL 1647 ContactProperty_ICON 1648 ContactProperty_NAME 1649 ContactProperty_TEL 1650 ) 1651 1652 func (ContactProperty) FromRef(str js.Ref) ContactProperty { 1653 return ContactProperty(bindings.ConstOfContactProperty(str)) 1654 } 1655 1656 func (x ContactProperty) String() (string, bool) { 1657 switch x { 1658 case ContactProperty_ADDRESS: 1659 return "address", true 1660 case ContactProperty_EMAIL: 1661 return "email", true 1662 case ContactProperty_ICON: 1663 return "icon", true 1664 case ContactProperty_NAME: 1665 return "name", true 1666 case ContactProperty_TEL: 1667 return "tel", true 1668 default: 1669 return "", false 1670 } 1671 } 1672 1673 type ContactAddress struct { 1674 ref js.Ref 1675 } 1676 1677 func (this ContactAddress) Once() ContactAddress { 1678 this.ref.Once() 1679 return this 1680 } 1681 1682 func (this ContactAddress) Ref() js.Ref { 1683 return this.ref 1684 } 1685 1686 func (this ContactAddress) FromRef(ref js.Ref) ContactAddress { 1687 this.ref = ref 1688 return this 1689 } 1690 1691 func (this ContactAddress) Free() { 1692 this.ref.Free() 1693 } 1694 1695 // City returns the value of property "ContactAddress.city". 1696 // 1697 // It returns ok=false if there is no such property. 1698 func (this ContactAddress) City() (ret js.String, ok bool) { 1699 ok = js.True == bindings.GetContactAddressCity( 1700 this.ref, js.Pointer(&ret), 1701 ) 1702 return 1703 } 1704 1705 // Country returns the value of property "ContactAddress.country". 1706 // 1707 // It returns ok=false if there is no such property. 1708 func (this ContactAddress) Country() (ret js.String, ok bool) { 1709 ok = js.True == bindings.GetContactAddressCountry( 1710 this.ref, js.Pointer(&ret), 1711 ) 1712 return 1713 } 1714 1715 // DependentLocality returns the value of property "ContactAddress.dependentLocality". 1716 // 1717 // It returns ok=false if there is no such property. 1718 func (this ContactAddress) DependentLocality() (ret js.String, ok bool) { 1719 ok = js.True == bindings.GetContactAddressDependentLocality( 1720 this.ref, js.Pointer(&ret), 1721 ) 1722 return 1723 } 1724 1725 // Organization returns the value of property "ContactAddress.organization". 1726 // 1727 // It returns ok=false if there is no such property. 1728 func (this ContactAddress) Organization() (ret js.String, ok bool) { 1729 ok = js.True == bindings.GetContactAddressOrganization( 1730 this.ref, js.Pointer(&ret), 1731 ) 1732 return 1733 } 1734 1735 // Phone returns the value of property "ContactAddress.phone". 1736 // 1737 // It returns ok=false if there is no such property. 1738 func (this ContactAddress) Phone() (ret js.String, ok bool) { 1739 ok = js.True == bindings.GetContactAddressPhone( 1740 this.ref, js.Pointer(&ret), 1741 ) 1742 return 1743 } 1744 1745 // PostalCode returns the value of property "ContactAddress.postalCode". 1746 // 1747 // It returns ok=false if there is no such property. 1748 func (this ContactAddress) PostalCode() (ret js.String, ok bool) { 1749 ok = js.True == bindings.GetContactAddressPostalCode( 1750 this.ref, js.Pointer(&ret), 1751 ) 1752 return 1753 } 1754 1755 // Recipient returns the value of property "ContactAddress.recipient". 1756 // 1757 // It returns ok=false if there is no such property. 1758 func (this ContactAddress) Recipient() (ret js.String, ok bool) { 1759 ok = js.True == bindings.GetContactAddressRecipient( 1760 this.ref, js.Pointer(&ret), 1761 ) 1762 return 1763 } 1764 1765 // Region returns the value of property "ContactAddress.region". 1766 // 1767 // It returns ok=false if there is no such property. 1768 func (this ContactAddress) Region() (ret js.String, ok bool) { 1769 ok = js.True == bindings.GetContactAddressRegion( 1770 this.ref, js.Pointer(&ret), 1771 ) 1772 return 1773 } 1774 1775 // SortingCode returns the value of property "ContactAddress.sortingCode". 1776 // 1777 // It returns ok=false if there is no such property. 1778 func (this ContactAddress) SortingCode() (ret js.String, ok bool) { 1779 ok = js.True == bindings.GetContactAddressSortingCode( 1780 this.ref, js.Pointer(&ret), 1781 ) 1782 return 1783 } 1784 1785 // AddressLine returns the value of property "ContactAddress.addressLine". 1786 // 1787 // It returns ok=false if there is no such property. 1788 func (this ContactAddress) AddressLine() (ret js.FrozenArray[js.String], ok bool) { 1789 ok = js.True == bindings.GetContactAddressAddressLine( 1790 this.ref, js.Pointer(&ret), 1791 ) 1792 return 1793 } 1794 1795 // HasFuncToJSON returns true if the method "ContactAddress.toJSON" exists. 1796 func (this ContactAddress) HasFuncToJSON() bool { 1797 return js.True == bindings.HasFuncContactAddressToJSON( 1798 this.ref, 1799 ) 1800 } 1801 1802 // FuncToJSON returns the method "ContactAddress.toJSON". 1803 func (this ContactAddress) FuncToJSON() (fn js.Func[func() js.Object]) { 1804 bindings.FuncContactAddressToJSON( 1805 this.ref, js.Pointer(&fn), 1806 ) 1807 return 1808 } 1809 1810 // ToJSON calls the method "ContactAddress.toJSON". 1811 func (this ContactAddress) ToJSON() (ret js.Object) { 1812 bindings.CallContactAddressToJSON( 1813 this.ref, js.Pointer(&ret), 1814 ) 1815 1816 return 1817 } 1818 1819 // TryToJSON calls the method "ContactAddress.toJSON" 1820 // in a try/catch block and returns (_, err, ok = false) when it went through 1821 // the catch clause. 1822 func (this ContactAddress) TryToJSON() (ret js.Object, exception js.Any, ok bool) { 1823 ok = js.True == bindings.TryContactAddressToJSON( 1824 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1825 ) 1826 1827 return 1828 } 1829 1830 type ContactInfo struct { 1831 // Address is "ContactInfo.address" 1832 // 1833 // Optional 1834 Address js.Array[ContactAddress] 1835 // Email is "ContactInfo.email" 1836 // 1837 // Optional 1838 Email js.Array[js.String] 1839 // Icon is "ContactInfo.icon" 1840 // 1841 // Optional 1842 Icon js.Array[Blob] 1843 // Name is "ContactInfo.name" 1844 // 1845 // Optional 1846 Name js.Array[js.String] 1847 // Tel is "ContactInfo.tel" 1848 // 1849 // Optional 1850 Tel js.Array[js.String] 1851 1852 FFI_USE bool 1853 } 1854 1855 // FromRef calls UpdateFrom and returns a ContactInfo with all fields set. 1856 func (p ContactInfo) FromRef(ref js.Ref) ContactInfo { 1857 p.UpdateFrom(ref) 1858 return p 1859 } 1860 1861 // New creates a new ContactInfo in the application heap. 1862 func (p ContactInfo) New() js.Ref { 1863 return bindings.ContactInfoJSLoad( 1864 js.Pointer(&p), js.True, 0, 1865 ) 1866 } 1867 1868 // UpdateFrom copies value of all fields of the heap object to p. 1869 func (p *ContactInfo) UpdateFrom(ref js.Ref) { 1870 bindings.ContactInfoJSStore( 1871 js.Pointer(p), ref, 1872 ) 1873 } 1874 1875 // Update writes all fields of the p to the heap object referenced by ref. 1876 func (p *ContactInfo) Update(ref js.Ref) { 1877 bindings.ContactInfoJSLoad( 1878 js.Pointer(p), js.False, ref, 1879 ) 1880 } 1881 1882 // FreeMembers frees fields with heap reference, if recursive is true 1883 // free all heap references reachable from p. 1884 func (p *ContactInfo) FreeMembers(recursive bool) { 1885 js.Free( 1886 p.Address.Ref(), 1887 p.Email.Ref(), 1888 p.Icon.Ref(), 1889 p.Name.Ref(), 1890 p.Tel.Ref(), 1891 ) 1892 p.Address = p.Address.FromRef(js.Undefined) 1893 p.Email = p.Email.FromRef(js.Undefined) 1894 p.Icon = p.Icon.FromRef(js.Undefined) 1895 p.Name = p.Name.FromRef(js.Undefined) 1896 p.Tel = p.Tel.FromRef(js.Undefined) 1897 } 1898 1899 type ContactsSelectOptions struct { 1900 // Multiple is "ContactsSelectOptions.multiple" 1901 // 1902 // Optional, defaults to false. 1903 // 1904 // NOTE: FFI_USE_Multiple MUST be set to true to make this field effective. 1905 Multiple bool 1906 1907 FFI_USE_Multiple bool // for Multiple. 1908 1909 FFI_USE bool 1910 } 1911 1912 // FromRef calls UpdateFrom and returns a ContactsSelectOptions with all fields set. 1913 func (p ContactsSelectOptions) FromRef(ref js.Ref) ContactsSelectOptions { 1914 p.UpdateFrom(ref) 1915 return p 1916 } 1917 1918 // New creates a new ContactsSelectOptions in the application heap. 1919 func (p ContactsSelectOptions) New() js.Ref { 1920 return bindings.ContactsSelectOptionsJSLoad( 1921 js.Pointer(&p), js.True, 0, 1922 ) 1923 } 1924 1925 // UpdateFrom copies value of all fields of the heap object to p. 1926 func (p *ContactsSelectOptions) UpdateFrom(ref js.Ref) { 1927 bindings.ContactsSelectOptionsJSStore( 1928 js.Pointer(p), ref, 1929 ) 1930 } 1931 1932 // Update writes all fields of the p to the heap object referenced by ref. 1933 func (p *ContactsSelectOptions) Update(ref js.Ref) { 1934 bindings.ContactsSelectOptionsJSLoad( 1935 js.Pointer(p), js.False, ref, 1936 ) 1937 } 1938 1939 // FreeMembers frees fields with heap reference, if recursive is true 1940 // free all heap references reachable from p. 1941 func (p *ContactsSelectOptions) FreeMembers(recursive bool) { 1942 } 1943 1944 type ContactsManager struct { 1945 ref js.Ref 1946 } 1947 1948 func (this ContactsManager) Once() ContactsManager { 1949 this.ref.Once() 1950 return this 1951 } 1952 1953 func (this ContactsManager) Ref() js.Ref { 1954 return this.ref 1955 } 1956 1957 func (this ContactsManager) FromRef(ref js.Ref) ContactsManager { 1958 this.ref = ref 1959 return this 1960 } 1961 1962 func (this ContactsManager) Free() { 1963 this.ref.Free() 1964 } 1965 1966 // HasFuncGetProperties returns true if the method "ContactsManager.getProperties" exists. 1967 func (this ContactsManager) HasFuncGetProperties() bool { 1968 return js.True == bindings.HasFuncContactsManagerGetProperties( 1969 this.ref, 1970 ) 1971 } 1972 1973 // FuncGetProperties returns the method "ContactsManager.getProperties". 1974 func (this ContactsManager) FuncGetProperties() (fn js.Func[func() js.Promise[js.Array[ContactProperty]]]) { 1975 bindings.FuncContactsManagerGetProperties( 1976 this.ref, js.Pointer(&fn), 1977 ) 1978 return 1979 } 1980 1981 // GetProperties calls the method "ContactsManager.getProperties". 1982 func (this ContactsManager) GetProperties() (ret js.Promise[js.Array[ContactProperty]]) { 1983 bindings.CallContactsManagerGetProperties( 1984 this.ref, js.Pointer(&ret), 1985 ) 1986 1987 return 1988 } 1989 1990 // TryGetProperties calls the method "ContactsManager.getProperties" 1991 // in a try/catch block and returns (_, err, ok = false) when it went through 1992 // the catch clause. 1993 func (this ContactsManager) TryGetProperties() (ret js.Promise[js.Array[ContactProperty]], exception js.Any, ok bool) { 1994 ok = js.True == bindings.TryContactsManagerGetProperties( 1995 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1996 ) 1997 1998 return 1999 } 2000 2001 // HasFuncSelect returns true if the method "ContactsManager.select" exists. 2002 func (this ContactsManager) HasFuncSelect() bool { 2003 return js.True == bindings.HasFuncContactsManagerSelect( 2004 this.ref, 2005 ) 2006 } 2007 2008 // FuncSelect returns the method "ContactsManager.select". 2009 func (this ContactsManager) FuncSelect() (fn js.Func[func(properties js.Array[ContactProperty], options ContactsSelectOptions) js.Promise[js.Array[ContactInfo]]]) { 2010 bindings.FuncContactsManagerSelect( 2011 this.ref, js.Pointer(&fn), 2012 ) 2013 return 2014 } 2015 2016 // Select calls the method "ContactsManager.select". 2017 func (this ContactsManager) Select(properties js.Array[ContactProperty], options ContactsSelectOptions) (ret js.Promise[js.Array[ContactInfo]]) { 2018 bindings.CallContactsManagerSelect( 2019 this.ref, js.Pointer(&ret), 2020 properties.Ref(), 2021 js.Pointer(&options), 2022 ) 2023 2024 return 2025 } 2026 2027 // TrySelect calls the method "ContactsManager.select" 2028 // in a try/catch block and returns (_, err, ok = false) when it went through 2029 // the catch clause. 2030 func (this ContactsManager) TrySelect(properties js.Array[ContactProperty], options ContactsSelectOptions) (ret js.Promise[js.Array[ContactInfo]], exception js.Any, ok bool) { 2031 ok = js.True == bindings.TryContactsManagerSelect( 2032 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2033 properties.Ref(), 2034 js.Pointer(&options), 2035 ) 2036 2037 return 2038 } 2039 2040 // HasFuncSelect1 returns true if the method "ContactsManager.select" exists. 2041 func (this ContactsManager) HasFuncSelect1() bool { 2042 return js.True == bindings.HasFuncContactsManagerSelect1( 2043 this.ref, 2044 ) 2045 } 2046 2047 // FuncSelect1 returns the method "ContactsManager.select". 2048 func (this ContactsManager) FuncSelect1() (fn js.Func[func(properties js.Array[ContactProperty]) js.Promise[js.Array[ContactInfo]]]) { 2049 bindings.FuncContactsManagerSelect1( 2050 this.ref, js.Pointer(&fn), 2051 ) 2052 return 2053 } 2054 2055 // Select1 calls the method "ContactsManager.select". 2056 func (this ContactsManager) Select1(properties js.Array[ContactProperty]) (ret js.Promise[js.Array[ContactInfo]]) { 2057 bindings.CallContactsManagerSelect1( 2058 this.ref, js.Pointer(&ret), 2059 properties.Ref(), 2060 ) 2061 2062 return 2063 } 2064 2065 // TrySelect1 calls the method "ContactsManager.select" 2066 // in a try/catch block and returns (_, err, ok = false) when it went through 2067 // the catch clause. 2068 func (this ContactsManager) TrySelect1(properties js.Array[ContactProperty]) (ret js.Promise[js.Array[ContactInfo]], exception js.Any, ok bool) { 2069 ok = js.True == bindings.TryContactsManagerSelect1( 2070 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2071 properties.Ref(), 2072 ) 2073 2074 return 2075 } 2076 2077 type KeyboardLayoutMap struct { 2078 ref js.Ref 2079 } 2080 2081 func (this KeyboardLayoutMap) Once() KeyboardLayoutMap { 2082 this.ref.Once() 2083 return this 2084 } 2085 2086 func (this KeyboardLayoutMap) Ref() js.Ref { 2087 return this.ref 2088 } 2089 2090 func (this KeyboardLayoutMap) FromRef(ref js.Ref) KeyboardLayoutMap { 2091 this.ref = ref 2092 return this 2093 } 2094 2095 func (this KeyboardLayoutMap) Free() { 2096 this.ref.Free() 2097 } 2098 2099 type Keyboard struct { 2100 EventTarget 2101 } 2102 2103 func (this Keyboard) Once() Keyboard { 2104 this.ref.Once() 2105 return this 2106 } 2107 2108 func (this Keyboard) Ref() js.Ref { 2109 return this.EventTarget.Ref() 2110 } 2111 2112 func (this Keyboard) FromRef(ref js.Ref) Keyboard { 2113 this.EventTarget = this.EventTarget.FromRef(ref) 2114 return this 2115 } 2116 2117 func (this Keyboard) Free() { 2118 this.ref.Free() 2119 } 2120 2121 // HasFuncLock returns true if the method "Keyboard.lock" exists. 2122 func (this Keyboard) HasFuncLock() bool { 2123 return js.True == bindings.HasFuncKeyboardLock( 2124 this.ref, 2125 ) 2126 } 2127 2128 // FuncLock returns the method "Keyboard.lock". 2129 func (this Keyboard) FuncLock() (fn js.Func[func(keyCodes js.Array[js.String]) js.Promise[js.Void]]) { 2130 bindings.FuncKeyboardLock( 2131 this.ref, js.Pointer(&fn), 2132 ) 2133 return 2134 } 2135 2136 // Lock calls the method "Keyboard.lock". 2137 func (this Keyboard) Lock(keyCodes js.Array[js.String]) (ret js.Promise[js.Void]) { 2138 bindings.CallKeyboardLock( 2139 this.ref, js.Pointer(&ret), 2140 keyCodes.Ref(), 2141 ) 2142 2143 return 2144 } 2145 2146 // TryLock calls the method "Keyboard.lock" 2147 // in a try/catch block and returns (_, err, ok = false) when it went through 2148 // the catch clause. 2149 func (this Keyboard) TryLock(keyCodes js.Array[js.String]) (ret js.Promise[js.Void], exception js.Any, ok bool) { 2150 ok = js.True == bindings.TryKeyboardLock( 2151 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2152 keyCodes.Ref(), 2153 ) 2154 2155 return 2156 } 2157 2158 // HasFuncLock1 returns true if the method "Keyboard.lock" exists. 2159 func (this Keyboard) HasFuncLock1() bool { 2160 return js.True == bindings.HasFuncKeyboardLock1( 2161 this.ref, 2162 ) 2163 } 2164 2165 // FuncLock1 returns the method "Keyboard.lock". 2166 func (this Keyboard) FuncLock1() (fn js.Func[func() js.Promise[js.Void]]) { 2167 bindings.FuncKeyboardLock1( 2168 this.ref, js.Pointer(&fn), 2169 ) 2170 return 2171 } 2172 2173 // Lock1 calls the method "Keyboard.lock". 2174 func (this Keyboard) Lock1() (ret js.Promise[js.Void]) { 2175 bindings.CallKeyboardLock1( 2176 this.ref, js.Pointer(&ret), 2177 ) 2178 2179 return 2180 } 2181 2182 // TryLock1 calls the method "Keyboard.lock" 2183 // in a try/catch block and returns (_, err, ok = false) when it went through 2184 // the catch clause. 2185 func (this Keyboard) TryLock1() (ret js.Promise[js.Void], exception js.Any, ok bool) { 2186 ok = js.True == bindings.TryKeyboardLock1( 2187 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2188 ) 2189 2190 return 2191 } 2192 2193 // HasFuncUnlock returns true if the method "Keyboard.unlock" exists. 2194 func (this Keyboard) HasFuncUnlock() bool { 2195 return js.True == bindings.HasFuncKeyboardUnlock( 2196 this.ref, 2197 ) 2198 } 2199 2200 // FuncUnlock returns the method "Keyboard.unlock". 2201 func (this Keyboard) FuncUnlock() (fn js.Func[func()]) { 2202 bindings.FuncKeyboardUnlock( 2203 this.ref, js.Pointer(&fn), 2204 ) 2205 return 2206 } 2207 2208 // Unlock calls the method "Keyboard.unlock". 2209 func (this Keyboard) Unlock() (ret js.Void) { 2210 bindings.CallKeyboardUnlock( 2211 this.ref, js.Pointer(&ret), 2212 ) 2213 2214 return 2215 } 2216 2217 // TryUnlock calls the method "Keyboard.unlock" 2218 // in a try/catch block and returns (_, err, ok = false) when it went through 2219 // the catch clause. 2220 func (this Keyboard) TryUnlock() (ret js.Void, exception js.Any, ok bool) { 2221 ok = js.True == bindings.TryKeyboardUnlock( 2222 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2223 ) 2224 2225 return 2226 } 2227 2228 // HasFuncGetLayoutMap returns true if the method "Keyboard.getLayoutMap" exists. 2229 func (this Keyboard) HasFuncGetLayoutMap() bool { 2230 return js.True == bindings.HasFuncKeyboardGetLayoutMap( 2231 this.ref, 2232 ) 2233 } 2234 2235 // FuncGetLayoutMap returns the method "Keyboard.getLayoutMap". 2236 func (this Keyboard) FuncGetLayoutMap() (fn js.Func[func() js.Promise[KeyboardLayoutMap]]) { 2237 bindings.FuncKeyboardGetLayoutMap( 2238 this.ref, js.Pointer(&fn), 2239 ) 2240 return 2241 } 2242 2243 // GetLayoutMap calls the method "Keyboard.getLayoutMap". 2244 func (this Keyboard) GetLayoutMap() (ret js.Promise[KeyboardLayoutMap]) { 2245 bindings.CallKeyboardGetLayoutMap( 2246 this.ref, js.Pointer(&ret), 2247 ) 2248 2249 return 2250 } 2251 2252 // TryGetLayoutMap calls the method "Keyboard.getLayoutMap" 2253 // in a try/catch block and returns (_, err, ok = false) when it went through 2254 // the catch clause. 2255 func (this Keyboard) TryGetLayoutMap() (ret js.Promise[KeyboardLayoutMap], exception js.Any, ok bool) { 2256 ok = js.True == bindings.TryKeyboardGetLayoutMap( 2257 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2258 ) 2259 2260 return 2261 } 2262 2263 type MediaSessionAction uint32 2264 2265 const ( 2266 _ MediaSessionAction = iota 2267 2268 MediaSessionAction_PLAY 2269 MediaSessionAction_PAUSE 2270 MediaSessionAction_SEEKBACKWARD 2271 MediaSessionAction_SEEKFORWARD 2272 MediaSessionAction_PREVIOUSTRACK 2273 MediaSessionAction_NEXTTRACK 2274 MediaSessionAction_SKIPAD 2275 MediaSessionAction_STOP 2276 MediaSessionAction_SEEKTO 2277 MediaSessionAction_TOGGLEMICROPHONE 2278 MediaSessionAction_TOGGLECAMERA 2279 MediaSessionAction_HANGUP 2280 MediaSessionAction_PREVIOUSSLIDE 2281 MediaSessionAction_NEXTSLIDE 2282 ) 2283 2284 func (MediaSessionAction) FromRef(str js.Ref) MediaSessionAction { 2285 return MediaSessionAction(bindings.ConstOfMediaSessionAction(str)) 2286 } 2287 2288 func (x MediaSessionAction) String() (string, bool) { 2289 switch x { 2290 case MediaSessionAction_PLAY: 2291 return "play", true 2292 case MediaSessionAction_PAUSE: 2293 return "pause", true 2294 case MediaSessionAction_SEEKBACKWARD: 2295 return "seekbackward", true 2296 case MediaSessionAction_SEEKFORWARD: 2297 return "seekforward", true 2298 case MediaSessionAction_PREVIOUSTRACK: 2299 return "previoustrack", true 2300 case MediaSessionAction_NEXTTRACK: 2301 return "nexttrack", true 2302 case MediaSessionAction_SKIPAD: 2303 return "skipad", true 2304 case MediaSessionAction_STOP: 2305 return "stop", true 2306 case MediaSessionAction_SEEKTO: 2307 return "seekto", true 2308 case MediaSessionAction_TOGGLEMICROPHONE: 2309 return "togglemicrophone", true 2310 case MediaSessionAction_TOGGLECAMERA: 2311 return "togglecamera", true 2312 case MediaSessionAction_HANGUP: 2313 return "hangup", true 2314 case MediaSessionAction_PREVIOUSSLIDE: 2315 return "previousslide", true 2316 case MediaSessionAction_NEXTSLIDE: 2317 return "nextslide", true 2318 default: 2319 return "", false 2320 } 2321 } 2322 2323 type MediaSessionActionHandlerFunc func(this js.Ref, details *MediaSessionActionDetails) js.Ref 2324 2325 func (fn MediaSessionActionHandlerFunc) Register() js.Func[func(details *MediaSessionActionDetails)] { 2326 return js.RegisterCallback[func(details *MediaSessionActionDetails)]( 2327 fn, abi.FuncPCABIInternal(fn), 2328 ) 2329 } 2330 2331 func (fn MediaSessionActionHandlerFunc) DispatchCallback( 2332 targetPC uintptr, ctx *js.CallbackContext, 2333 ) { 2334 args := ctx.Args() 2335 if len(args) != 1+1 /* js this */ || 2336 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 2337 js.ThrowInvalidCallbackInvocation() 2338 } 2339 var arg0 MediaSessionActionDetails 2340 arg0.UpdateFrom(args[0+1]) 2341 defer arg0.FreeMembers(true) 2342 2343 if ctx.Return(fn( 2344 args[0], 2345 2346 mark.NoEscape(&arg0), 2347 )) { 2348 return 2349 } 2350 2351 js.ThrowCallbackValueNotReturned() 2352 } 2353 2354 type MediaSessionActionHandler[T any] struct { 2355 Fn func(arg T, this js.Ref, details *MediaSessionActionDetails) js.Ref 2356 Arg T 2357 } 2358 2359 func (cb *MediaSessionActionHandler[T]) Register() js.Func[func(details *MediaSessionActionDetails)] { 2360 return js.RegisterCallback[func(details *MediaSessionActionDetails)]( 2361 cb, abi.FuncPCABIInternal(cb.Fn), 2362 ) 2363 } 2364 2365 func (cb *MediaSessionActionHandler[T]) DispatchCallback( 2366 targetPC uintptr, ctx *js.CallbackContext, 2367 ) { 2368 args := ctx.Args() 2369 if len(args) != 1+1 /* js this */ || 2370 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 2371 js.ThrowInvalidCallbackInvocation() 2372 } 2373 var arg0 MediaSessionActionDetails 2374 arg0.UpdateFrom(args[0+1]) 2375 defer arg0.FreeMembers(true) 2376 2377 if ctx.Return(cb.Fn( 2378 cb.Arg, 2379 args[0], 2380 2381 mark.NoEscape(&arg0), 2382 )) { 2383 return 2384 } 2385 2386 js.ThrowCallbackValueNotReturned() 2387 } 2388 2389 type MediaSessionActionDetails struct { 2390 // Action is "MediaSessionActionDetails.action" 2391 // 2392 // Required 2393 Action MediaSessionAction 2394 // SeekOffset is "MediaSessionActionDetails.seekOffset" 2395 // 2396 // Optional 2397 // 2398 // NOTE: FFI_USE_SeekOffset MUST be set to true to make this field effective. 2399 SeekOffset float64 2400 // SeekTime is "MediaSessionActionDetails.seekTime" 2401 // 2402 // Optional 2403 // 2404 // NOTE: FFI_USE_SeekTime MUST be set to true to make this field effective. 2405 SeekTime float64 2406 // FastSeek is "MediaSessionActionDetails.fastSeek" 2407 // 2408 // Optional 2409 // 2410 // NOTE: FFI_USE_FastSeek MUST be set to true to make this field effective. 2411 FastSeek bool 2412 2413 FFI_USE_SeekOffset bool // for SeekOffset. 2414 FFI_USE_SeekTime bool // for SeekTime. 2415 FFI_USE_FastSeek bool // for FastSeek. 2416 2417 FFI_USE bool 2418 } 2419 2420 // FromRef calls UpdateFrom and returns a MediaSessionActionDetails with all fields set. 2421 func (p MediaSessionActionDetails) FromRef(ref js.Ref) MediaSessionActionDetails { 2422 p.UpdateFrom(ref) 2423 return p 2424 } 2425 2426 // New creates a new MediaSessionActionDetails in the application heap. 2427 func (p MediaSessionActionDetails) New() js.Ref { 2428 return bindings.MediaSessionActionDetailsJSLoad( 2429 js.Pointer(&p), js.True, 0, 2430 ) 2431 } 2432 2433 // UpdateFrom copies value of all fields of the heap object to p. 2434 func (p *MediaSessionActionDetails) UpdateFrom(ref js.Ref) { 2435 bindings.MediaSessionActionDetailsJSStore( 2436 js.Pointer(p), ref, 2437 ) 2438 } 2439 2440 // Update writes all fields of the p to the heap object referenced by ref. 2441 func (p *MediaSessionActionDetails) Update(ref js.Ref) { 2442 bindings.MediaSessionActionDetailsJSLoad( 2443 js.Pointer(p), js.False, ref, 2444 ) 2445 } 2446 2447 // FreeMembers frees fields with heap reference, if recursive is true 2448 // free all heap references reachable from p. 2449 func (p *MediaSessionActionDetails) FreeMembers(recursive bool) { 2450 } 2451 2452 type MediaPositionState struct { 2453 // Duration is "MediaPositionState.duration" 2454 // 2455 // Optional 2456 // 2457 // NOTE: FFI_USE_Duration MUST be set to true to make this field effective. 2458 Duration float64 2459 // PlaybackRate is "MediaPositionState.playbackRate" 2460 // 2461 // Optional 2462 // 2463 // NOTE: FFI_USE_PlaybackRate MUST be set to true to make this field effective. 2464 PlaybackRate float64 2465 // Position is "MediaPositionState.position" 2466 // 2467 // Optional 2468 // 2469 // NOTE: FFI_USE_Position MUST be set to true to make this field effective. 2470 Position float64 2471 2472 FFI_USE_Duration bool // for Duration. 2473 FFI_USE_PlaybackRate bool // for PlaybackRate. 2474 FFI_USE_Position bool // for Position. 2475 2476 FFI_USE bool 2477 } 2478 2479 // FromRef calls UpdateFrom and returns a MediaPositionState with all fields set. 2480 func (p MediaPositionState) FromRef(ref js.Ref) MediaPositionState { 2481 p.UpdateFrom(ref) 2482 return p 2483 } 2484 2485 // New creates a new MediaPositionState in the application heap. 2486 func (p MediaPositionState) New() js.Ref { 2487 return bindings.MediaPositionStateJSLoad( 2488 js.Pointer(&p), js.True, 0, 2489 ) 2490 } 2491 2492 // UpdateFrom copies value of all fields of the heap object to p. 2493 func (p *MediaPositionState) UpdateFrom(ref js.Ref) { 2494 bindings.MediaPositionStateJSStore( 2495 js.Pointer(p), ref, 2496 ) 2497 } 2498 2499 // Update writes all fields of the p to the heap object referenced by ref. 2500 func (p *MediaPositionState) Update(ref js.Ref) { 2501 bindings.MediaPositionStateJSLoad( 2502 js.Pointer(p), js.False, ref, 2503 ) 2504 } 2505 2506 // FreeMembers frees fields with heap reference, if recursive is true 2507 // free all heap references reachable from p. 2508 func (p *MediaPositionState) FreeMembers(recursive bool) { 2509 } 2510 2511 type MediaImage struct { 2512 // Src is "MediaImage.src" 2513 // 2514 // Required 2515 Src js.String 2516 // Sizes is "MediaImage.sizes" 2517 // 2518 // Optional, defaults to "". 2519 Sizes js.String 2520 // Type is "MediaImage.type" 2521 // 2522 // Optional, defaults to "". 2523 Type js.String 2524 2525 FFI_USE bool 2526 } 2527 2528 // FromRef calls UpdateFrom and returns a MediaImage with all fields set. 2529 func (p MediaImage) FromRef(ref js.Ref) MediaImage { 2530 p.UpdateFrom(ref) 2531 return p 2532 } 2533 2534 // New creates a new MediaImage in the application heap. 2535 func (p MediaImage) New() js.Ref { 2536 return bindings.MediaImageJSLoad( 2537 js.Pointer(&p), js.True, 0, 2538 ) 2539 } 2540 2541 // UpdateFrom copies value of all fields of the heap object to p. 2542 func (p *MediaImage) UpdateFrom(ref js.Ref) { 2543 bindings.MediaImageJSStore( 2544 js.Pointer(p), ref, 2545 ) 2546 } 2547 2548 // Update writes all fields of the p to the heap object referenced by ref. 2549 func (p *MediaImage) Update(ref js.Ref) { 2550 bindings.MediaImageJSLoad( 2551 js.Pointer(p), js.False, ref, 2552 ) 2553 } 2554 2555 // FreeMembers frees fields with heap reference, if recursive is true 2556 // free all heap references reachable from p. 2557 func (p *MediaImage) FreeMembers(recursive bool) { 2558 js.Free( 2559 p.Src.Ref(), 2560 p.Sizes.Ref(), 2561 p.Type.Ref(), 2562 ) 2563 p.Src = p.Src.FromRef(js.Undefined) 2564 p.Sizes = p.Sizes.FromRef(js.Undefined) 2565 p.Type = p.Type.FromRef(js.Undefined) 2566 } 2567 2568 type MediaMetadataInit struct { 2569 // Title is "MediaMetadataInit.title" 2570 // 2571 // Optional, defaults to "". 2572 Title js.String 2573 // Artist is "MediaMetadataInit.artist" 2574 // 2575 // Optional, defaults to "". 2576 Artist js.String 2577 // Album is "MediaMetadataInit.album" 2578 // 2579 // Optional, defaults to "". 2580 Album js.String 2581 // Artwork is "MediaMetadataInit.artwork" 2582 // 2583 // Optional, defaults to []. 2584 Artwork js.Array[MediaImage] 2585 2586 FFI_USE bool 2587 } 2588 2589 // FromRef calls UpdateFrom and returns a MediaMetadataInit with all fields set. 2590 func (p MediaMetadataInit) FromRef(ref js.Ref) MediaMetadataInit { 2591 p.UpdateFrom(ref) 2592 return p 2593 } 2594 2595 // New creates a new MediaMetadataInit in the application heap. 2596 func (p MediaMetadataInit) New() js.Ref { 2597 return bindings.MediaMetadataInitJSLoad( 2598 js.Pointer(&p), js.True, 0, 2599 ) 2600 } 2601 2602 // UpdateFrom copies value of all fields of the heap object to p. 2603 func (p *MediaMetadataInit) UpdateFrom(ref js.Ref) { 2604 bindings.MediaMetadataInitJSStore( 2605 js.Pointer(p), ref, 2606 ) 2607 } 2608 2609 // Update writes all fields of the p to the heap object referenced by ref. 2610 func (p *MediaMetadataInit) Update(ref js.Ref) { 2611 bindings.MediaMetadataInitJSLoad( 2612 js.Pointer(p), js.False, ref, 2613 ) 2614 } 2615 2616 // FreeMembers frees fields with heap reference, if recursive is true 2617 // free all heap references reachable from p. 2618 func (p *MediaMetadataInit) FreeMembers(recursive bool) { 2619 js.Free( 2620 p.Title.Ref(), 2621 p.Artist.Ref(), 2622 p.Album.Ref(), 2623 p.Artwork.Ref(), 2624 ) 2625 p.Title = p.Title.FromRef(js.Undefined) 2626 p.Artist = p.Artist.FromRef(js.Undefined) 2627 p.Album = p.Album.FromRef(js.Undefined) 2628 p.Artwork = p.Artwork.FromRef(js.Undefined) 2629 } 2630 2631 func NewMediaMetadata(init MediaMetadataInit) (ret MediaMetadata) { 2632 ret.ref = bindings.NewMediaMetadataByMediaMetadata( 2633 js.Pointer(&init)) 2634 return 2635 } 2636 2637 func NewMediaMetadataByMediaMetadata1() (ret MediaMetadata) { 2638 ret.ref = bindings.NewMediaMetadataByMediaMetadata1() 2639 return 2640 } 2641 2642 type MediaMetadata struct { 2643 ref js.Ref 2644 } 2645 2646 func (this MediaMetadata) Once() MediaMetadata { 2647 this.ref.Once() 2648 return this 2649 } 2650 2651 func (this MediaMetadata) Ref() js.Ref { 2652 return this.ref 2653 } 2654 2655 func (this MediaMetadata) FromRef(ref js.Ref) MediaMetadata { 2656 this.ref = ref 2657 return this 2658 } 2659 2660 func (this MediaMetadata) Free() { 2661 this.ref.Free() 2662 } 2663 2664 // Title returns the value of property "MediaMetadata.title". 2665 // 2666 // It returns ok=false if there is no such property. 2667 func (this MediaMetadata) Title() (ret js.String, ok bool) { 2668 ok = js.True == bindings.GetMediaMetadataTitle( 2669 this.ref, js.Pointer(&ret), 2670 ) 2671 return 2672 } 2673 2674 // SetTitle sets the value of property "MediaMetadata.title" to val. 2675 // 2676 // It returns false if the property cannot be set. 2677 func (this MediaMetadata) SetTitle(val js.String) bool { 2678 return js.True == bindings.SetMediaMetadataTitle( 2679 this.ref, 2680 val.Ref(), 2681 ) 2682 } 2683 2684 // Artist returns the value of property "MediaMetadata.artist". 2685 // 2686 // It returns ok=false if there is no such property. 2687 func (this MediaMetadata) Artist() (ret js.String, ok bool) { 2688 ok = js.True == bindings.GetMediaMetadataArtist( 2689 this.ref, js.Pointer(&ret), 2690 ) 2691 return 2692 } 2693 2694 // SetArtist sets the value of property "MediaMetadata.artist" to val. 2695 // 2696 // It returns false if the property cannot be set. 2697 func (this MediaMetadata) SetArtist(val js.String) bool { 2698 return js.True == bindings.SetMediaMetadataArtist( 2699 this.ref, 2700 val.Ref(), 2701 ) 2702 } 2703 2704 // Album returns the value of property "MediaMetadata.album". 2705 // 2706 // It returns ok=false if there is no such property. 2707 func (this MediaMetadata) Album() (ret js.String, ok bool) { 2708 ok = js.True == bindings.GetMediaMetadataAlbum( 2709 this.ref, js.Pointer(&ret), 2710 ) 2711 return 2712 } 2713 2714 // SetAlbum sets the value of property "MediaMetadata.album" to val. 2715 // 2716 // It returns false if the property cannot be set. 2717 func (this MediaMetadata) SetAlbum(val js.String) bool { 2718 return js.True == bindings.SetMediaMetadataAlbum( 2719 this.ref, 2720 val.Ref(), 2721 ) 2722 } 2723 2724 // Artwork returns the value of property "MediaMetadata.artwork". 2725 // 2726 // It returns ok=false if there is no such property. 2727 func (this MediaMetadata) Artwork() (ret js.FrozenArray[MediaImage], ok bool) { 2728 ok = js.True == bindings.GetMediaMetadataArtwork( 2729 this.ref, js.Pointer(&ret), 2730 ) 2731 return 2732 } 2733 2734 // SetArtwork sets the value of property "MediaMetadata.artwork" to val. 2735 // 2736 // It returns false if the property cannot be set. 2737 func (this MediaMetadata) SetArtwork(val js.FrozenArray[MediaImage]) bool { 2738 return js.True == bindings.SetMediaMetadataArtwork( 2739 this.ref, 2740 val.Ref(), 2741 ) 2742 } 2743 2744 type MediaSessionPlaybackState uint32 2745 2746 const ( 2747 _ MediaSessionPlaybackState = iota 2748 2749 MediaSessionPlaybackState_NONE 2750 MediaSessionPlaybackState_PAUSED 2751 MediaSessionPlaybackState_PLAYING 2752 ) 2753 2754 func (MediaSessionPlaybackState) FromRef(str js.Ref) MediaSessionPlaybackState { 2755 return MediaSessionPlaybackState(bindings.ConstOfMediaSessionPlaybackState(str)) 2756 } 2757 2758 func (x MediaSessionPlaybackState) String() (string, bool) { 2759 switch x { 2760 case MediaSessionPlaybackState_NONE: 2761 return "none", true 2762 case MediaSessionPlaybackState_PAUSED: 2763 return "paused", true 2764 case MediaSessionPlaybackState_PLAYING: 2765 return "playing", true 2766 default: 2767 return "", false 2768 } 2769 } 2770 2771 type MediaSession struct { 2772 ref js.Ref 2773 } 2774 2775 func (this MediaSession) Once() MediaSession { 2776 this.ref.Once() 2777 return this 2778 } 2779 2780 func (this MediaSession) Ref() js.Ref { 2781 return this.ref 2782 } 2783 2784 func (this MediaSession) FromRef(ref js.Ref) MediaSession { 2785 this.ref = ref 2786 return this 2787 } 2788 2789 func (this MediaSession) Free() { 2790 this.ref.Free() 2791 } 2792 2793 // Metadata returns the value of property "MediaSession.metadata". 2794 // 2795 // It returns ok=false if there is no such property. 2796 func (this MediaSession) Metadata() (ret MediaMetadata, ok bool) { 2797 ok = js.True == bindings.GetMediaSessionMetadata( 2798 this.ref, js.Pointer(&ret), 2799 ) 2800 return 2801 } 2802 2803 // SetMetadata sets the value of property "MediaSession.metadata" to val. 2804 // 2805 // It returns false if the property cannot be set. 2806 func (this MediaSession) SetMetadata(val MediaMetadata) bool { 2807 return js.True == bindings.SetMediaSessionMetadata( 2808 this.ref, 2809 val.Ref(), 2810 ) 2811 } 2812 2813 // PlaybackState returns the value of property "MediaSession.playbackState". 2814 // 2815 // It returns ok=false if there is no such property. 2816 func (this MediaSession) PlaybackState() (ret MediaSessionPlaybackState, ok bool) { 2817 ok = js.True == bindings.GetMediaSessionPlaybackState( 2818 this.ref, js.Pointer(&ret), 2819 ) 2820 return 2821 } 2822 2823 // SetPlaybackState sets the value of property "MediaSession.playbackState" to val. 2824 // 2825 // It returns false if the property cannot be set. 2826 func (this MediaSession) SetPlaybackState(val MediaSessionPlaybackState) bool { 2827 return js.True == bindings.SetMediaSessionPlaybackState( 2828 this.ref, 2829 uint32(val), 2830 ) 2831 } 2832 2833 // HasFuncSetActionHandler returns true if the method "MediaSession.setActionHandler" exists. 2834 func (this MediaSession) HasFuncSetActionHandler() bool { 2835 return js.True == bindings.HasFuncMediaSessionSetActionHandler( 2836 this.ref, 2837 ) 2838 } 2839 2840 // FuncSetActionHandler returns the method "MediaSession.setActionHandler". 2841 func (this MediaSession) FuncSetActionHandler() (fn js.Func[func(action MediaSessionAction, handler js.Func[func(details *MediaSessionActionDetails)])]) { 2842 bindings.FuncMediaSessionSetActionHandler( 2843 this.ref, js.Pointer(&fn), 2844 ) 2845 return 2846 } 2847 2848 // SetActionHandler calls the method "MediaSession.setActionHandler". 2849 func (this MediaSession) SetActionHandler(action MediaSessionAction, handler js.Func[func(details *MediaSessionActionDetails)]) (ret js.Void) { 2850 bindings.CallMediaSessionSetActionHandler( 2851 this.ref, js.Pointer(&ret), 2852 uint32(action), 2853 handler.Ref(), 2854 ) 2855 2856 return 2857 } 2858 2859 // TrySetActionHandler calls the method "MediaSession.setActionHandler" 2860 // in a try/catch block and returns (_, err, ok = false) when it went through 2861 // the catch clause. 2862 func (this MediaSession) TrySetActionHandler(action MediaSessionAction, handler js.Func[func(details *MediaSessionActionDetails)]) (ret js.Void, exception js.Any, ok bool) { 2863 ok = js.True == bindings.TryMediaSessionSetActionHandler( 2864 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2865 uint32(action), 2866 handler.Ref(), 2867 ) 2868 2869 return 2870 } 2871 2872 // HasFuncSetPositionState returns true if the method "MediaSession.setPositionState" exists. 2873 func (this MediaSession) HasFuncSetPositionState() bool { 2874 return js.True == bindings.HasFuncMediaSessionSetPositionState( 2875 this.ref, 2876 ) 2877 } 2878 2879 // FuncSetPositionState returns the method "MediaSession.setPositionState". 2880 func (this MediaSession) FuncSetPositionState() (fn js.Func[func(state MediaPositionState)]) { 2881 bindings.FuncMediaSessionSetPositionState( 2882 this.ref, js.Pointer(&fn), 2883 ) 2884 return 2885 } 2886 2887 // SetPositionState calls the method "MediaSession.setPositionState". 2888 func (this MediaSession) SetPositionState(state MediaPositionState) (ret js.Void) { 2889 bindings.CallMediaSessionSetPositionState( 2890 this.ref, js.Pointer(&ret), 2891 js.Pointer(&state), 2892 ) 2893 2894 return 2895 } 2896 2897 // TrySetPositionState calls the method "MediaSession.setPositionState" 2898 // in a try/catch block and returns (_, err, ok = false) when it went through 2899 // the catch clause. 2900 func (this MediaSession) TrySetPositionState(state MediaPositionState) (ret js.Void, exception js.Any, ok bool) { 2901 ok = js.True == bindings.TryMediaSessionSetPositionState( 2902 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2903 js.Pointer(&state), 2904 ) 2905 2906 return 2907 } 2908 2909 // HasFuncSetPositionState1 returns true if the method "MediaSession.setPositionState" exists. 2910 func (this MediaSession) HasFuncSetPositionState1() bool { 2911 return js.True == bindings.HasFuncMediaSessionSetPositionState1( 2912 this.ref, 2913 ) 2914 } 2915 2916 // FuncSetPositionState1 returns the method "MediaSession.setPositionState". 2917 func (this MediaSession) FuncSetPositionState1() (fn js.Func[func()]) { 2918 bindings.FuncMediaSessionSetPositionState1( 2919 this.ref, js.Pointer(&fn), 2920 ) 2921 return 2922 } 2923 2924 // SetPositionState1 calls the method "MediaSession.setPositionState". 2925 func (this MediaSession) SetPositionState1() (ret js.Void) { 2926 bindings.CallMediaSessionSetPositionState1( 2927 this.ref, js.Pointer(&ret), 2928 ) 2929 2930 return 2931 } 2932 2933 // TrySetPositionState1 calls the method "MediaSession.setPositionState" 2934 // in a try/catch block and returns (_, err, ok = false) when it went through 2935 // the catch clause. 2936 func (this MediaSession) TrySetPositionState1() (ret js.Void, exception js.Any, ok bool) { 2937 ok = js.True == bindings.TryMediaSessionSetPositionState1( 2938 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2939 ) 2940 2941 return 2942 } 2943 2944 // HasFuncSetMicrophoneActive returns true if the method "MediaSession.setMicrophoneActive" exists. 2945 func (this MediaSession) HasFuncSetMicrophoneActive() bool { 2946 return js.True == bindings.HasFuncMediaSessionSetMicrophoneActive( 2947 this.ref, 2948 ) 2949 } 2950 2951 // FuncSetMicrophoneActive returns the method "MediaSession.setMicrophoneActive". 2952 func (this MediaSession) FuncSetMicrophoneActive() (fn js.Func[func(active bool)]) { 2953 bindings.FuncMediaSessionSetMicrophoneActive( 2954 this.ref, js.Pointer(&fn), 2955 ) 2956 return 2957 } 2958 2959 // SetMicrophoneActive calls the method "MediaSession.setMicrophoneActive". 2960 func (this MediaSession) SetMicrophoneActive(active bool) (ret js.Void) { 2961 bindings.CallMediaSessionSetMicrophoneActive( 2962 this.ref, js.Pointer(&ret), 2963 js.Bool(bool(active)), 2964 ) 2965 2966 return 2967 } 2968 2969 // TrySetMicrophoneActive calls the method "MediaSession.setMicrophoneActive" 2970 // in a try/catch block and returns (_, err, ok = false) when it went through 2971 // the catch clause. 2972 func (this MediaSession) TrySetMicrophoneActive(active bool) (ret js.Void, exception js.Any, ok bool) { 2973 ok = js.True == bindings.TryMediaSessionSetMicrophoneActive( 2974 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2975 js.Bool(bool(active)), 2976 ) 2977 2978 return 2979 } 2980 2981 // HasFuncSetCameraActive returns true if the method "MediaSession.setCameraActive" exists. 2982 func (this MediaSession) HasFuncSetCameraActive() bool { 2983 return js.True == bindings.HasFuncMediaSessionSetCameraActive( 2984 this.ref, 2985 ) 2986 } 2987 2988 // FuncSetCameraActive returns the method "MediaSession.setCameraActive". 2989 func (this MediaSession) FuncSetCameraActive() (fn js.Func[func(active bool)]) { 2990 bindings.FuncMediaSessionSetCameraActive( 2991 this.ref, js.Pointer(&fn), 2992 ) 2993 return 2994 } 2995 2996 // SetCameraActive calls the method "MediaSession.setCameraActive". 2997 func (this MediaSession) SetCameraActive(active bool) (ret js.Void) { 2998 bindings.CallMediaSessionSetCameraActive( 2999 this.ref, js.Pointer(&ret), 3000 js.Bool(bool(active)), 3001 ) 3002 3003 return 3004 } 3005 3006 // TrySetCameraActive calls the method "MediaSession.setCameraActive" 3007 // in a try/catch block and returns (_, err, ok = false) when it went through 3008 // the catch clause. 3009 func (this MediaSession) TrySetCameraActive(active bool) (ret js.Void, exception js.Any, ok bool) { 3010 ok = js.True == bindings.TryMediaSessionSetCameraActive( 3011 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3012 js.Bool(bool(active)), 3013 ) 3014 3015 return 3016 } 3017 3018 type DevicePostureType uint32 3019 3020 const ( 3021 _ DevicePostureType = iota 3022 3023 DevicePostureType_CONTINUOUS 3024 DevicePostureType_FOLDED 3025 ) 3026 3027 func (DevicePostureType) FromRef(str js.Ref) DevicePostureType { 3028 return DevicePostureType(bindings.ConstOfDevicePostureType(str)) 3029 } 3030 3031 func (x DevicePostureType) String() (string, bool) { 3032 switch x { 3033 case DevicePostureType_CONTINUOUS: 3034 return "continuous", true 3035 case DevicePostureType_FOLDED: 3036 return "folded", true 3037 default: 3038 return "", false 3039 } 3040 } 3041 3042 type DevicePosture struct { 3043 EventTarget 3044 } 3045 3046 func (this DevicePosture) Once() DevicePosture { 3047 this.ref.Once() 3048 return this 3049 } 3050 3051 func (this DevicePosture) Ref() js.Ref { 3052 return this.EventTarget.Ref() 3053 } 3054 3055 func (this DevicePosture) FromRef(ref js.Ref) DevicePosture { 3056 this.EventTarget = this.EventTarget.FromRef(ref) 3057 return this 3058 } 3059 3060 func (this DevicePosture) Free() { 3061 this.ref.Free() 3062 } 3063 3064 // Type returns the value of property "DevicePosture.type". 3065 // 3066 // It returns ok=false if there is no such property. 3067 func (this DevicePosture) Type() (ret DevicePostureType, ok bool) { 3068 ok = js.True == bindings.GetDevicePostureType( 3069 this.ref, js.Pointer(&ret), 3070 ) 3071 return 3072 }