jsutil

package
v0.0.0-...-2a3efc0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitPromise

func AwaitPromise(v js.Value) (res []js.Value, err error)

AwaitPromise is a helper function that waits for a promise to resolve or reject and returns the results and an error value.

func BytesFromUint8Array

func BytesFromUint8Array(src js.Value) []byte

BytesFromUint8Array is a helper function that copies the given Uint8Array into a new byte slice.

func NewError

func NewError(err error) js.Value

NewError returns a new JavaScript error containing the message in the given error.

func NewPromise

func NewPromise(fn PromiseExecutor) js.Value

NewPromise returns a new promise that calls the given executor function.

func Uint8ArrayFromBytes

func Uint8ArrayFromBytes(src []byte) js.Value

Uint8ArrayFromBytes is a helper function that copies the given byte slice into a new Uint8Array.

Types

type PromiseExecutor

type PromiseExecutor func(resolve, reject func(args ...any) js.Value) any

PromiseExecutor is the function that will be called to resolve or reject the promise.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise#executor

Jump to

Keyboard shortcuts

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