Promise.cs
25 lines
| 539 B
| text/x-csharp
|
CSharpLexer
/ Implab / Promise.cs
cin
|
r119 | using System; | ||
cin
|
r144 | using Implab.Parallels; | ||
cin
|
r119 | |||
namespace Implab { | ||||
cin
|
r243 | public class Promise : AbstractPromise { | ||
cin
|
r205 | public static readonly IPromise Success; | ||
cin
|
r119 | |||
cin
|
r144 | static Promise() { | ||
cin
|
r205 | Success = new SuccessPromise(); | ||
cin
|
r119 | } | ||
cin
|
r243 | internal void ResolvePromise() { | ||
cin
|
r144 | SetResult(); | ||
cin
|
r119 | } | ||
cin
|
r243 | internal void RejectPromise(Exception error) { | ||
cin
|
r119 | SetError(error); | ||
cin
|
r243 | } | ||
public static IPromise Reject(Exception exception) { | ||||
return new FailedPromise(exception); | ||||
} | ||||
cin
|
r119 | } | ||
} | ||||