promise

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented     = errors.New("Browser not implemented Promise")
	ErrNotAPromise        = errors.New("Object is not a Promise")
	ErrResultPromiseError = errors.New("Result error promise")
)

Functions

func GetInterface

func GetInterface() js.Value

GetInterface get the JS interface

Types

type Promise

type Promise struct {
	baseobject.BaseObject
}

Promise struct

func All

func All(values ...interface{}) (Promise, error)

func AllSettled

func AllSettled(values ...interface{}) (Promise, error)

func Any

func Any(values ...interface{}) (Promise, error)

func New

func New(handler func(resolvefunc, errfunc js.Value) (interface{}, error)) (Promise, error)

func NewFromJSObject

func NewFromJSObject(obj js.Value) (Promise, error)

func Race

func Race(values ...interface{}) (Promise, error)

func Reject

func Reject(reason error) (Promise, error)

func Resolve

func Resolve(result interface{}) (Promise, error)

func SetTimeout

func SetTimeout(ms int) (Promise, error)

func (Promise) Await

func (p Promise) Await() (interface{}, error)

avoid used it can deadlocks

func (Promise) Catch

func (p Promise) Catch(reject func(error)) (Promise, error)

func (Promise) Finally

func (p Promise) Finally(f func()) error

func (Promise) Promise_

func (p Promise) Promise_() Promise

func (Promise) Then

func (p Promise) Then(resolve func(interface{}) *Promise, reject func(error)) (Promise, error)

type PromiseFrom

type PromiseFrom interface {
	Promise_() Promise
}

Jump to

Keyboard shortcuts

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