()
| 67 | } |
| 68 | |
| 69 | func (p *Promise[S]) Await() (err error) { |
| 70 | <-p.Done() |
| 71 | err = context.Cause(p.Context) |
| 72 | if err == errResolved { |
| 73 | err = nil |
| 74 | } |
| 75 | p.CancelFunc() |
| 76 | return |
| 77 | } |
| 78 | |
| 79 | func (p *Promise[S]) Then(resolved func(S), rejected func(error)) { |
| 80 | go func() { |