Documentation
¶
Index ¶
- func AsyncFunc(f func(this js.Value, p []js.Value) (any, error)) js.Func
- func Await(promise js.Value) (val js.Value, err error)
- func JsArrayToSlice(jsArray js.Value) []byte
- func Promise() (promise js.Value, resolve func(args ...any), reject func(args ...any))
- func ReleaseMap(m map[string]any)
- func SliceToJsArray(slice []byte) js.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncFunc ¶
Converts a synchronous Go function with error returns into a JavaScript function that executes the provided function asynchronously, returning a Promise which resolves with the result or rejects with an error message.
func Await ¶
Awaits the resolution or rejection of a JavaScript promise, returning the resulting value or error in Go.
func JsArrayToSlice ¶
Converts a JavaScript array (ArrayBuffer or Uint8Array) to a Go byte slice by copying its contents.
func Promise ¶
Creates a JavaScript Promise and returns the promise object along with Go functions to resolve or reject it.
func ReleaseMap ¶
Releases all JavaScript functions stored in the provided map to prevent resource leaks.
func SliceToJsArray ¶
Converts a Go byte slice into a JavaScript Uint8Array by copying its contents for interoperability with JavaScript code.
Types ¶
This section is empty.