promise

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await[T any](p *Promise[T]) (any, error)

Types

type Interval

type Interval struct {
	// contains filtered or unexported fields
}

func SetInterval

func SetInterval(duration time.Duration, f func(*Interval)) *Interval

func (*Interval) Close

func (this *Interval) Close()

func (*Interval) IsClose

func (this *Interval) IsClose() bool

type IntervalWaitFinish added in v0.3.37

type IntervalWaitFinish struct {
	// contains filtered or unexported fields
}

func SetIntervalWaitFinish added in v0.3.37

func SetIntervalWaitFinish(duration time.Duration, f func(*IntervalWaitFinish, time.Time, time.Duration)) *IntervalWaitFinish

func (*IntervalWaitFinish) Close added in v0.3.37

func (this *IntervalWaitFinish) Close()

type Promise

type Promise[T any] struct {
	// contains filtered or unexported fields
}

func All

func All(promises ...*Promise[any]) *Promise[any]

func AllSettled

func AllSettled(promises ...*Promise[any]) *Promise[any]

func Async

func Async[T any](executor func(resolve func(T), reject func(any))) *Promise[T]

func Each

func Each(promises ...*Promise[any]) *Promise[any]

func Race

func Race(promises ...*Promise[any]) *Promise[any]

func Reject

func Reject[T any](err error) *Promise[T]

func Resolve

func Resolve[T any](resolution any) *Promise[T]

func (*Promise[T]) Any added in v0.3.37

func (this *Promise[T]) Any() *Promise[any]

func (*Promise[T]) AsCallback

func (this *Promise[T]) AsCallback(f func(any, error))

func (*Promise[T]) Await

func (this *Promise[T]) Await() (any, error)

func (*Promise[T]) CalTime

func (this *Promise[T]) CalTime() *Promise[T]

func (*Promise[T]) Catch

func (this *Promise[T]) Catch(rejection func(err error) any) *Promise[T]

func (*Promise[T]) Elapse

func (this *Promise[T]) Elapse() time.Duration

func (*Promise[T]) Reject

func (this *Promise[T]) Reject(err any)

func (*Promise[T]) Resolve

func (this *Promise[T]) Resolve(resolution any)

func (*Promise[T]) Then

func (this *Promise[T]) Then(fulfillment func(data any) any) *Promise[T]

type Timeout

type Timeout struct {
	// contains filtered or unexported fields
}

func SetTimeout

func SetTimeout(duration time.Duration, f func(*Timeout)) *Timeout

func (*Timeout) Close

func (this *Timeout) Close()

func (*Timeout) IsClose

func (this *Timeout) IsClose() bool

Jump to

Keyboard shortcuts

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