github.com/primecitizens/pcz/std@v0.2.1/ffi/js/async/import_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package async 5 6 import ( 7 "unsafe" 8 9 "github.com/primecitizens/pcz/std/ffi/js/bindings" 10 ) 11 12 //go:wasmimport ffi/js/async promise 13 //go:noescape 14 func Promise(fn bindings.Ref) bindings.Ref 15 16 //go:wasmimport ffi/js/async resolved 17 //go:noescape 18 func Resolved(data bindings.Ref) bindings.Ref 19 20 //go:wasmimport ffi/js/async rejected 21 //go:noescape 22 func Rejected(reason bindings.Ref) bindings.Ref 23 24 //go:wasmimport ffi/js/async bg 25 //go:noescape 26 func Bg(promise bindings.Ref) bindings.Ref 27 28 //go:wasmimport ffi/js/async shouldwait 29 //go:noescape 30 func ShouldWait( 31 take bindings.Ref, 32 promise bindings.Ref, 33 pFulfilled unsafe.Pointer, 34 pRefData unsafe.Pointer, 35 ) (shouldWait bindings.Ref) 36 37 //go:wasmimport ffi/js/async takewaited 38 //go:noescape 39 func TakeWaited(ref bindings.Ref, pRefData unsafe.Pointer) (fulfilled bindings.Ref) 40 41 //go:wasmimport ffi/js/async allok 42 //go:noescape 43 func AllFulfilled(free bindings.Ref, pRefs unsafe.Pointer, n uint32) bindings.Ref 44 45 //go:wasmimport ffi/js/async all 46 //go:noescape 47 func AllFinished(free bindings.Ref, pRefs unsafe.Pointer, n uint32) bindings.Ref 48 49 //go:wasmimport ffi/js/async first 50 //go:noescape 51 func FirstFinished(free bindings.Ref, pRefs unsafe.Pointer, n uint32) bindings.Ref 52 53 //go:wasmimport ffi/js/async then 54 //go:noescape 55 func Then(onfulfilled, onrejected, finally bindings.Ref)