promise

package
v0.0.0-...-200f45e Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Promise

type Promise[T ~jsapi.ValueKind] struct {
	Value js.Value
}

func New

func New[T ~jsapi.ValueKind](use func(resolve func(T), reject func(error))) Promise[T]

func Resolve

func Resolve[T ~jsapi.ValueKind](v T) Promise[T]

func Then

func Then[A, B ~jsapi.ValueKind](
	pa Promise[A],
	onOk func(A) Promise[B],
	onError func(error) Promise[B],
) Promise[B]

func (Promise[T]) Thunk

func (p Promise[T]) Thunk() *thunk.Thunk[orerr.OrErr[T]]

func (Promise[T]) Wait

func (p Promise[T]) Wait() (T, error)

Wait blocks on the promise, returning the value and any error when it resolves.

Jump to

Keyboard shortcuts

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