github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/lockscreen/data/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package data 5 6 import ( 7 "github.com/primecitizens/pcz/std/core/abi" 8 "github.com/primecitizens/pcz/std/core/mark" 9 "github.com/primecitizens/pcz/std/ffi/js" 10 "github.com/primecitizens/pcz/std/plat/js/webext/lockscreen/data/bindings" 11 ) 12 13 type DataCallbackFunc func(this js.Ref, data js.ArrayBuffer) js.Ref 14 15 func (fn DataCallbackFunc) Register() js.Func[func(data js.ArrayBuffer)] { 16 return js.RegisterCallback[func(data js.ArrayBuffer)]( 17 fn, abi.FuncPCABIInternal(fn), 18 ) 19 } 20 21 func (fn DataCallbackFunc) DispatchCallback( 22 targetPC uintptr, ctx *js.CallbackContext, 23 ) { 24 args := ctx.Args() 25 if len(args) != 1+1 /* js this */ || 26 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 27 js.ThrowInvalidCallbackInvocation() 28 } 29 30 if ctx.Return(fn( 31 args[0], 32 33 js.ArrayBuffer{}.FromRef(args[0+1]), 34 )) { 35 return 36 } 37 38 js.ThrowCallbackValueNotReturned() 39 } 40 41 type DataCallback[T any] struct { 42 Fn func(arg T, this js.Ref, data js.ArrayBuffer) js.Ref 43 Arg T 44 } 45 46 func (cb *DataCallback[T]) Register() js.Func[func(data js.ArrayBuffer)] { 47 return js.RegisterCallback[func(data js.ArrayBuffer)]( 48 cb, abi.FuncPCABIInternal(cb.Fn), 49 ) 50 } 51 52 func (cb *DataCallback[T]) DispatchCallback( 53 targetPC uintptr, ctx *js.CallbackContext, 54 ) { 55 args := ctx.Args() 56 if len(args) != 1+1 /* js this */ || 57 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 58 js.ThrowInvalidCallbackInvocation() 59 } 60 61 if ctx.Return(cb.Fn( 62 cb.Arg, 63 args[0], 64 65 js.ArrayBuffer{}.FromRef(args[0+1]), 66 )) { 67 return 68 } 69 70 js.ThrowCallbackValueNotReturned() 71 } 72 73 type DataItemCallbackFunc func(this js.Ref, item *DataItemInfo) js.Ref 74 75 func (fn DataItemCallbackFunc) Register() js.Func[func(item *DataItemInfo)] { 76 return js.RegisterCallback[func(item *DataItemInfo)]( 77 fn, abi.FuncPCABIInternal(fn), 78 ) 79 } 80 81 func (fn DataItemCallbackFunc) DispatchCallback( 82 targetPC uintptr, ctx *js.CallbackContext, 83 ) { 84 args := ctx.Args() 85 if len(args) != 1+1 /* js this */ || 86 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 87 js.ThrowInvalidCallbackInvocation() 88 } 89 var arg0 DataItemInfo 90 arg0.UpdateFrom(args[0+1]) 91 defer arg0.FreeMembers(true) 92 93 if ctx.Return(fn( 94 args[0], 95 96 mark.NoEscape(&arg0), 97 )) { 98 return 99 } 100 101 js.ThrowCallbackValueNotReturned() 102 } 103 104 type DataItemCallback[T any] struct { 105 Fn func(arg T, this js.Ref, item *DataItemInfo) js.Ref 106 Arg T 107 } 108 109 func (cb *DataItemCallback[T]) Register() js.Func[func(item *DataItemInfo)] { 110 return js.RegisterCallback[func(item *DataItemInfo)]( 111 cb, abi.FuncPCABIInternal(cb.Fn), 112 ) 113 } 114 115 func (cb *DataItemCallback[T]) DispatchCallback( 116 targetPC uintptr, ctx *js.CallbackContext, 117 ) { 118 args := ctx.Args() 119 if len(args) != 1+1 /* js this */ || 120 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 121 js.ThrowInvalidCallbackInvocation() 122 } 123 var arg0 DataItemInfo 124 arg0.UpdateFrom(args[0+1]) 125 defer arg0.FreeMembers(true) 126 127 if ctx.Return(cb.Fn( 128 cb.Arg, 129 args[0], 130 131 mark.NoEscape(&arg0), 132 )) { 133 return 134 } 135 136 js.ThrowCallbackValueNotReturned() 137 } 138 139 type DataItemInfo struct { 140 // Id is "DataItemInfo.id" 141 // 142 // Optional 143 Id js.String 144 145 FFI_USE bool 146 } 147 148 // FromRef calls UpdateFrom and returns a DataItemInfo with all fields set. 149 func (p DataItemInfo) FromRef(ref js.Ref) DataItemInfo { 150 p.UpdateFrom(ref) 151 return p 152 } 153 154 // New creates a new DataItemInfo in the application heap. 155 func (p DataItemInfo) New() js.Ref { 156 return bindings.DataItemInfoJSLoad( 157 js.Pointer(&p), js.True, 0, 158 ) 159 } 160 161 // UpdateFrom copies value of all fields of the heap object to p. 162 func (p *DataItemInfo) UpdateFrom(ref js.Ref) { 163 bindings.DataItemInfoJSStore( 164 js.Pointer(p), ref, 165 ) 166 } 167 168 // Update writes all fields of the p to the heap object referenced by ref. 169 func (p *DataItemInfo) Update(ref js.Ref) { 170 bindings.DataItemInfoJSLoad( 171 js.Pointer(p), js.False, ref, 172 ) 173 } 174 175 // FreeMembers frees fields with heap reference, if recursive is true 176 // free all heap references reachable from p. 177 func (p *DataItemInfo) FreeMembers(recursive bool) { 178 js.Free( 179 p.Id.Ref(), 180 ) 181 p.Id = p.Id.FromRef(js.Undefined) 182 } 183 184 type DataItemListCallbackFunc func(this js.Ref, items js.Array[DataItemInfo]) js.Ref 185 186 func (fn DataItemListCallbackFunc) Register() js.Func[func(items js.Array[DataItemInfo])] { 187 return js.RegisterCallback[func(items js.Array[DataItemInfo])]( 188 fn, abi.FuncPCABIInternal(fn), 189 ) 190 } 191 192 func (fn DataItemListCallbackFunc) DispatchCallback( 193 targetPC uintptr, ctx *js.CallbackContext, 194 ) { 195 args := ctx.Args() 196 if len(args) != 1+1 /* js this */ || 197 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 198 js.ThrowInvalidCallbackInvocation() 199 } 200 201 if ctx.Return(fn( 202 args[0], 203 204 js.Array[DataItemInfo]{}.FromRef(args[0+1]), 205 )) { 206 return 207 } 208 209 js.ThrowCallbackValueNotReturned() 210 } 211 212 type DataItemListCallback[T any] struct { 213 Fn func(arg T, this js.Ref, items js.Array[DataItemInfo]) js.Ref 214 Arg T 215 } 216 217 func (cb *DataItemListCallback[T]) Register() js.Func[func(items js.Array[DataItemInfo])] { 218 return js.RegisterCallback[func(items js.Array[DataItemInfo])]( 219 cb, abi.FuncPCABIInternal(cb.Fn), 220 ) 221 } 222 223 func (cb *DataItemListCallback[T]) DispatchCallback( 224 targetPC uintptr, ctx *js.CallbackContext, 225 ) { 226 args := ctx.Args() 227 if len(args) != 1+1 /* js this */ || 228 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 229 js.ThrowInvalidCallbackInvocation() 230 } 231 232 if ctx.Return(cb.Fn( 233 cb.Arg, 234 args[0], 235 236 js.Array[DataItemInfo]{}.FromRef(args[0+1]), 237 )) { 238 return 239 } 240 241 js.ThrowCallbackValueNotReturned() 242 } 243 244 type DataItemsAvailableEvent struct { 245 // WasLocked is "DataItemsAvailableEvent.wasLocked" 246 // 247 // Optional 248 // 249 // NOTE: FFI_USE_WasLocked MUST be set to true to make this field effective. 250 WasLocked bool 251 252 FFI_USE_WasLocked bool // for WasLocked. 253 254 FFI_USE bool 255 } 256 257 // FromRef calls UpdateFrom and returns a DataItemsAvailableEvent with all fields set. 258 func (p DataItemsAvailableEvent) FromRef(ref js.Ref) DataItemsAvailableEvent { 259 p.UpdateFrom(ref) 260 return p 261 } 262 263 // New creates a new DataItemsAvailableEvent in the application heap. 264 func (p DataItemsAvailableEvent) New() js.Ref { 265 return bindings.DataItemsAvailableEventJSLoad( 266 js.Pointer(&p), js.True, 0, 267 ) 268 } 269 270 // UpdateFrom copies value of all fields of the heap object to p. 271 func (p *DataItemsAvailableEvent) UpdateFrom(ref js.Ref) { 272 bindings.DataItemsAvailableEventJSStore( 273 js.Pointer(p), ref, 274 ) 275 } 276 277 // Update writes all fields of the p to the heap object referenced by ref. 278 func (p *DataItemsAvailableEvent) Update(ref js.Ref) { 279 bindings.DataItemsAvailableEventJSLoad( 280 js.Pointer(p), js.False, ref, 281 ) 282 } 283 284 // FreeMembers frees fields with heap reference, if recursive is true 285 // free all heap references reachable from p. 286 func (p *DataItemsAvailableEvent) FreeMembers(recursive bool) { 287 } 288 289 type VoidCallbackFunc func(this js.Ref) js.Ref 290 291 func (fn VoidCallbackFunc) Register() js.Func[func()] { 292 return js.RegisterCallback[func()]( 293 fn, abi.FuncPCABIInternal(fn), 294 ) 295 } 296 297 func (fn VoidCallbackFunc) DispatchCallback( 298 targetPC uintptr, ctx *js.CallbackContext, 299 ) { 300 args := ctx.Args() 301 if len(args) != 0+1 /* js this */ || 302 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 303 js.ThrowInvalidCallbackInvocation() 304 } 305 306 if ctx.Return(fn( 307 args[0], 308 )) { 309 return 310 } 311 312 js.ThrowCallbackValueNotReturned() 313 } 314 315 type VoidCallback[T any] struct { 316 Fn func(arg T, this js.Ref) js.Ref 317 Arg T 318 } 319 320 func (cb *VoidCallback[T]) Register() js.Func[func()] { 321 return js.RegisterCallback[func()]( 322 cb, abi.FuncPCABIInternal(cb.Fn), 323 ) 324 } 325 326 func (cb *VoidCallback[T]) DispatchCallback( 327 targetPC uintptr, ctx *js.CallbackContext, 328 ) { 329 args := ctx.Args() 330 if len(args) != 0+1 /* js this */ || 331 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 332 js.ThrowInvalidCallbackInvocation() 333 } 334 335 if ctx.Return(cb.Fn( 336 cb.Arg, 337 args[0], 338 )) { 339 return 340 } 341 342 js.ThrowCallbackValueNotReturned() 343 } 344 345 // HasFuncCreate returns true if the function "WEBEXT.lockScreen.data.create" exists. 346 func HasFuncCreate() bool { 347 return js.True == bindings.HasFuncCreate() 348 } 349 350 // FuncCreate returns the function "WEBEXT.lockScreen.data.create". 351 func FuncCreate() (fn js.Func[func() js.Promise[DataItemInfo]]) { 352 bindings.FuncCreate( 353 js.Pointer(&fn), 354 ) 355 return 356 } 357 358 // Create calls the function "WEBEXT.lockScreen.data.create" directly. 359 func Create() (ret js.Promise[DataItemInfo]) { 360 bindings.CallCreate( 361 js.Pointer(&ret), 362 ) 363 364 return 365 } 366 367 // TryCreate calls the function "WEBEXT.lockScreen.data.create" 368 // in a try/catch block and returns (_, err, ok = false) when it went through 369 // the catch clause. 370 func TryCreate() (ret js.Promise[DataItemInfo], exception js.Any, ok bool) { 371 ok = js.True == bindings.TryCreate( 372 js.Pointer(&ret), js.Pointer(&exception), 373 ) 374 375 return 376 } 377 378 // HasFuncDelete returns true if the function "WEBEXT.lockScreen.data.delete" exists. 379 func HasFuncDelete() bool { 380 return js.True == bindings.HasFuncDelete() 381 } 382 383 // FuncDelete returns the function "WEBEXT.lockScreen.data.delete". 384 func FuncDelete() (fn js.Func[func(id js.String) js.Promise[js.Void]]) { 385 bindings.FuncDelete( 386 js.Pointer(&fn), 387 ) 388 return 389 } 390 391 // Delete calls the function "WEBEXT.lockScreen.data.delete" directly. 392 func Delete(id js.String) (ret js.Promise[js.Void]) { 393 bindings.CallDelete( 394 js.Pointer(&ret), 395 id.Ref(), 396 ) 397 398 return 399 } 400 401 // TryDelete calls the function "WEBEXT.lockScreen.data.delete" 402 // in a try/catch block and returns (_, err, ok = false) when it went through 403 // the catch clause. 404 func TryDelete(id js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) { 405 ok = js.True == bindings.TryDelete( 406 js.Pointer(&ret), js.Pointer(&exception), 407 id.Ref(), 408 ) 409 410 return 411 } 412 413 // HasFuncGetAll returns true if the function "WEBEXT.lockScreen.data.getAll" exists. 414 func HasFuncGetAll() bool { 415 return js.True == bindings.HasFuncGetAll() 416 } 417 418 // FuncGetAll returns the function "WEBEXT.lockScreen.data.getAll". 419 func FuncGetAll() (fn js.Func[func() js.Promise[js.Array[DataItemInfo]]]) { 420 bindings.FuncGetAll( 421 js.Pointer(&fn), 422 ) 423 return 424 } 425 426 // GetAll calls the function "WEBEXT.lockScreen.data.getAll" directly. 427 func GetAll() (ret js.Promise[js.Array[DataItemInfo]]) { 428 bindings.CallGetAll( 429 js.Pointer(&ret), 430 ) 431 432 return 433 } 434 435 // TryGetAll calls the function "WEBEXT.lockScreen.data.getAll" 436 // in a try/catch block and returns (_, err, ok = false) when it went through 437 // the catch clause. 438 func TryGetAll() (ret js.Promise[js.Array[DataItemInfo]], exception js.Any, ok bool) { 439 ok = js.True == bindings.TryGetAll( 440 js.Pointer(&ret), js.Pointer(&exception), 441 ) 442 443 return 444 } 445 446 // HasFuncGetContent returns true if the function "WEBEXT.lockScreen.data.getContent" exists. 447 func HasFuncGetContent() bool { 448 return js.True == bindings.HasFuncGetContent() 449 } 450 451 // FuncGetContent returns the function "WEBEXT.lockScreen.data.getContent". 452 func FuncGetContent() (fn js.Func[func(id js.String) js.Promise[js.ArrayBuffer]]) { 453 bindings.FuncGetContent( 454 js.Pointer(&fn), 455 ) 456 return 457 } 458 459 // GetContent calls the function "WEBEXT.lockScreen.data.getContent" directly. 460 func GetContent(id js.String) (ret js.Promise[js.ArrayBuffer]) { 461 bindings.CallGetContent( 462 js.Pointer(&ret), 463 id.Ref(), 464 ) 465 466 return 467 } 468 469 // TryGetContent calls the function "WEBEXT.lockScreen.data.getContent" 470 // in a try/catch block and returns (_, err, ok = false) when it went through 471 // the catch clause. 472 func TryGetContent(id js.String) (ret js.Promise[js.ArrayBuffer], exception js.Any, ok bool) { 473 ok = js.True == bindings.TryGetContent( 474 js.Pointer(&ret), js.Pointer(&exception), 475 id.Ref(), 476 ) 477 478 return 479 } 480 481 type OnDataItemsAvailableEventCallbackFunc func(this js.Ref, event *DataItemsAvailableEvent) js.Ref 482 483 func (fn OnDataItemsAvailableEventCallbackFunc) Register() js.Func[func(event *DataItemsAvailableEvent)] { 484 return js.RegisterCallback[func(event *DataItemsAvailableEvent)]( 485 fn, abi.FuncPCABIInternal(fn), 486 ) 487 } 488 489 func (fn OnDataItemsAvailableEventCallbackFunc) DispatchCallback( 490 targetPC uintptr, ctx *js.CallbackContext, 491 ) { 492 args := ctx.Args() 493 if len(args) != 1+1 /* js this */ || 494 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 495 js.ThrowInvalidCallbackInvocation() 496 } 497 var arg0 DataItemsAvailableEvent 498 arg0.UpdateFrom(args[0+1]) 499 defer arg0.FreeMembers(true) 500 501 if ctx.Return(fn( 502 args[0], 503 504 mark.NoEscape(&arg0), 505 )) { 506 return 507 } 508 509 js.ThrowCallbackValueNotReturned() 510 } 511 512 type OnDataItemsAvailableEventCallback[T any] struct { 513 Fn func(arg T, this js.Ref, event *DataItemsAvailableEvent) js.Ref 514 Arg T 515 } 516 517 func (cb *OnDataItemsAvailableEventCallback[T]) Register() js.Func[func(event *DataItemsAvailableEvent)] { 518 return js.RegisterCallback[func(event *DataItemsAvailableEvent)]( 519 cb, abi.FuncPCABIInternal(cb.Fn), 520 ) 521 } 522 523 func (cb *OnDataItemsAvailableEventCallback[T]) DispatchCallback( 524 targetPC uintptr, ctx *js.CallbackContext, 525 ) { 526 args := ctx.Args() 527 if len(args) != 1+1 /* js this */ || 528 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 529 js.ThrowInvalidCallbackInvocation() 530 } 531 var arg0 DataItemsAvailableEvent 532 arg0.UpdateFrom(args[0+1]) 533 defer arg0.FreeMembers(true) 534 535 if ctx.Return(cb.Fn( 536 cb.Arg, 537 args[0], 538 539 mark.NoEscape(&arg0), 540 )) { 541 return 542 } 543 544 js.ThrowCallbackValueNotReturned() 545 } 546 547 // HasFuncOnDataItemsAvailable returns true if the function "WEBEXT.lockScreen.data.onDataItemsAvailable.addListener" exists. 548 func HasFuncOnDataItemsAvailable() bool { 549 return js.True == bindings.HasFuncOnDataItemsAvailable() 550 } 551 552 // FuncOnDataItemsAvailable returns the function "WEBEXT.lockScreen.data.onDataItemsAvailable.addListener". 553 func FuncOnDataItemsAvailable() (fn js.Func[func(callback js.Func[func(event *DataItemsAvailableEvent)])]) { 554 bindings.FuncOnDataItemsAvailable( 555 js.Pointer(&fn), 556 ) 557 return 558 } 559 560 // OnDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.addListener" directly. 561 func OnDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret js.Void) { 562 bindings.CallOnDataItemsAvailable( 563 js.Pointer(&ret), 564 callback.Ref(), 565 ) 566 567 return 568 } 569 570 // TryOnDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.addListener" 571 // in a try/catch block and returns (_, err, ok = false) when it went through 572 // the catch clause. 573 func TryOnDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret js.Void, exception js.Any, ok bool) { 574 ok = js.True == bindings.TryOnDataItemsAvailable( 575 js.Pointer(&ret), js.Pointer(&exception), 576 callback.Ref(), 577 ) 578 579 return 580 } 581 582 // HasFuncOffDataItemsAvailable returns true if the function "WEBEXT.lockScreen.data.onDataItemsAvailable.removeListener" exists. 583 func HasFuncOffDataItemsAvailable() bool { 584 return js.True == bindings.HasFuncOffDataItemsAvailable() 585 } 586 587 // FuncOffDataItemsAvailable returns the function "WEBEXT.lockScreen.data.onDataItemsAvailable.removeListener". 588 func FuncOffDataItemsAvailable() (fn js.Func[func(callback js.Func[func(event *DataItemsAvailableEvent)])]) { 589 bindings.FuncOffDataItemsAvailable( 590 js.Pointer(&fn), 591 ) 592 return 593 } 594 595 // OffDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.removeListener" directly. 596 func OffDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret js.Void) { 597 bindings.CallOffDataItemsAvailable( 598 js.Pointer(&ret), 599 callback.Ref(), 600 ) 601 602 return 603 } 604 605 // TryOffDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.removeListener" 606 // in a try/catch block and returns (_, err, ok = false) when it went through 607 // the catch clause. 608 func TryOffDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret js.Void, exception js.Any, ok bool) { 609 ok = js.True == bindings.TryOffDataItemsAvailable( 610 js.Pointer(&ret), js.Pointer(&exception), 611 callback.Ref(), 612 ) 613 614 return 615 } 616 617 // HasFuncHasOnDataItemsAvailable returns true if the function "WEBEXT.lockScreen.data.onDataItemsAvailable.hasListener" exists. 618 func HasFuncHasOnDataItemsAvailable() bool { 619 return js.True == bindings.HasFuncHasOnDataItemsAvailable() 620 } 621 622 // FuncHasOnDataItemsAvailable returns the function "WEBEXT.lockScreen.data.onDataItemsAvailable.hasListener". 623 func FuncHasOnDataItemsAvailable() (fn js.Func[func(callback js.Func[func(event *DataItemsAvailableEvent)]) bool]) { 624 bindings.FuncHasOnDataItemsAvailable( 625 js.Pointer(&fn), 626 ) 627 return 628 } 629 630 // HasOnDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.hasListener" directly. 631 func HasOnDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret bool) { 632 bindings.CallHasOnDataItemsAvailable( 633 js.Pointer(&ret), 634 callback.Ref(), 635 ) 636 637 return 638 } 639 640 // TryHasOnDataItemsAvailable calls the function "WEBEXT.lockScreen.data.onDataItemsAvailable.hasListener" 641 // in a try/catch block and returns (_, err, ok = false) when it went through 642 // the catch clause. 643 func TryHasOnDataItemsAvailable(callback js.Func[func(event *DataItemsAvailableEvent)]) (ret bool, exception js.Any, ok bool) { 644 ok = js.True == bindings.TryHasOnDataItemsAvailable( 645 js.Pointer(&ret), js.Pointer(&exception), 646 callback.Ref(), 647 ) 648 649 return 650 } 651 652 // HasFuncSetContent returns true if the function "WEBEXT.lockScreen.data.setContent" exists. 653 func HasFuncSetContent() bool { 654 return js.True == bindings.HasFuncSetContent() 655 } 656 657 // FuncSetContent returns the function "WEBEXT.lockScreen.data.setContent". 658 func FuncSetContent() (fn js.Func[func(id js.String, data js.ArrayBuffer) js.Promise[js.Void]]) { 659 bindings.FuncSetContent( 660 js.Pointer(&fn), 661 ) 662 return 663 } 664 665 // SetContent calls the function "WEBEXT.lockScreen.data.setContent" directly. 666 func SetContent(id js.String, data js.ArrayBuffer) (ret js.Promise[js.Void]) { 667 bindings.CallSetContent( 668 js.Pointer(&ret), 669 id.Ref(), 670 data.Ref(), 671 ) 672 673 return 674 } 675 676 // TrySetContent calls the function "WEBEXT.lockScreen.data.setContent" 677 // in a try/catch block and returns (_, err, ok = false) when it went through 678 // the catch clause. 679 func TrySetContent(id js.String, data js.ArrayBuffer) (ret js.Promise[js.Void], exception js.Any, ok bool) { 680 ok = js.True == bindings.TrySetContent( 681 js.Pointer(&ret), js.Pointer(&exception), 682 id.Ref(), 683 data.Ref(), 684 ) 685 686 return 687 }