promise

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(interface{}) interface{}

type Promise

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

func New

func New(fn func(resolve, reject Handler)) *Promise

func (*Promise) Catch

func (p *Promise) Catch(onError Handler) Thenable

func (*Promise) Finally

func (p *Promise) Finally(onFinally func())

func (*Promise) Then

func (p *Promise) Then(handlers ...Handler) Thenable

type Thenable

type Thenable interface {
	Then(...Handler) Thenable
	Catch(Handler) Thenable
	Finally(func())
}

type TypeState

type TypeState string
const (
	TypeStatePending   TypeState = "pending"
	TypeStateFulfilled TypeState = "fulfilled"
	TypeStateRejected  TypeState = "rejected"
)

Jump to

Keyboard shortcuts

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