js

package
v0.0.0-...-956700b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncFunc

func AsyncFunc(f func(this js.Value, p []js.Value) (any, error)) js.Func

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

func Await(promise js.Value) (val js.Value, err error)

Awaits the resolution or rejection of a JavaScript promise, returning the resulting value or error in Go.

func JsArrayToSlice

func JsArrayToSlice(jsArray js.Value) []byte

Converts a JavaScript array (ArrayBuffer or Uint8Array) to a Go byte slice by copying its contents.

func Promise

func Promise() (promise js.Value, resolve func(args ...any), reject func(args ...any))

Creates a JavaScript Promise and returns the promise object along with Go functions to resolve or reject it.

func ReleaseMap

func ReleaseMap(m map[string]any)

Releases all JavaScript functions stored in the provided map to prevent resource leaks.

func SliceToJsArray

func SliceToJsArray(slice []byte) js.Value

Converts a Go byte slice into a JavaScript Uint8Array by copying its contents for interoperability with JavaScript code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL