Mercurial > pub > ImplabNet
comparison Implab/ResolvedPromise.cs @ 248:5cb4826c2c2a v3
Added awaiters to promises
Added static methods to Promise Resolve, Reject, All.
Updated promise helpers
| author | cin | 
|---|---|
| date | Tue, 30 Jan 2018 01:37:17 +0300 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 247:fb70574741a1 | 248:5cb4826c2c2a | 
|---|---|
| 1 using System; | |
| 2 | |
| 3 namespace Implab | |
| 4 { | |
| 5 public struct ResolvedPromise : IPromise { | |
| 6 public Type ResultType => typeof(void); | |
| 7 | |
| 8 public bool IsResolved => true; | |
| 9 | |
| 10 public bool IsRejected => false; | |
| 11 | |
| 12 public bool IsFulfilled => true; | |
| 13 | |
| 14 public Exception RejectReason => null; | |
| 15 | |
| 16 public IPromise<T> Cast<T>() { | |
| 17 throw new InvalidCastException(); | |
| 18 } | |
| 19 | |
| 20 public void Join() { | |
| 21 } | |
| 22 | |
| 23 public void Join(int timeout) { | |
| 24 } | |
| 25 | |
| 26 public void Then(IResolvable next) { | |
| 27 next.Resolve(); | |
| 28 } | |
| 29 } | |
| 30 } | 
