Mercurial > pub > ImplabNet
comparison Implab/IPromise.cs @ 242:cbe10ac0731e v3
Working on promises
| author | cin | 
|---|---|
| date | Wed, 24 Jan 2018 03:03:21 +0300 | 
| parents | ec91a6dfa5b3 | 
| children | b1e0ffdf3451 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 240:fa6cbf4d8841 | 242:cbe10ac0731e | 
|---|---|
| 7 public interface IPromise: ICancellable { | 7 public interface IPromise: ICancellable { | 
| 8 | 8 | 
| 9 /// <summary> | 9 /// <summary> | 
| 10 /// Тип результата, получаемого через данное обещание. | 10 /// Тип результата, получаемого через данное обещание. | 
| 11 /// </summary> | 11 /// </summary> | 
| 12 Type PromiseType { get; } | 12 Type ResultType { get; } | 
| 13 | 13 | 
| 14 /// <summary> | 14 /// <summary> | 
| 15 /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено. | 15 /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено. | 
| 16 /// </summary> | 16 /// </summary> | 
| 17 bool IsFulfilled { get; } | |
| 18 | |
| 19 bool IsRejected { get; } | |
| 20 | |
| 17 bool IsResolved { get; } | 21 bool IsResolved { get; } | 
| 18 | |
| 19 /// <summary> | |
| 20 /// Обещание было отменено. | |
| 21 /// </summary> | |
| 22 bool IsCancelled { get; } | |
| 23 | 22 | 
| 24 /// <summary> | 23 /// <summary> | 
| 25 /// Исключение возникшее в результате выполнения обещания, либо причина отмены. | 24 /// Исключение возникшее в результате выполнения обещания, либо причина отмены. | 
| 26 /// </summary> | 25 /// </summary> | 
| 27 Exception Error { get; } | 26 Exception RejectReason { get; } | 
| 28 | 27 | 
| 29 /// <summary> | 28 /// <summary> | 
| 30 /// Adds specified listeners to the current promise. | 29 /// Adds specified listeners to the current promise. | 
| 31 /// </summary> | 30 /// </summary> | 
| 32 /// <param name="success">The handler called on the successful promise completion.</param> | 31 /// <param name="success">The handler called on the successful promise completion.</param> | 
| 33 /// <param name="error">The handler is called if an error while completing the promise occurred.</param> | 32 /// <param name="error">The handler is called if an error while completing the promise occurred.</param> | 
| 34 /// <param name="cancel">The handler is called in case of promise cancellation.</param> | |
| 35 /// <returns>The current promise.</returns> | 33 /// <returns>The current promise.</returns> | 
| 36 IPromise On(Action success, Action<Exception> error, Action<Exception> cancel); | 34 void On(Action success, Action<Exception> error); | 
| 37 IPromise On(Action success, Action<Exception> error); | |
| 38 IPromise On(Action success); | |
| 39 | |
| 40 /// <summary> | |
| 41 /// Adds specified listeners to the current promise. | |
| 42 /// </summary> | |
| 43 /// <param name="handler">The handler called on the specified events.</param> | |
| 44 /// <param name = "events">The combination of flags denoting the events for which the | |
| 45 /// handler shoud be called.</param> | |
| 46 /// <returns>The current promise.</returns> | |
| 47 IPromise On(Action handler, PromiseEventType events); | |
| 48 | 35 | 
| 49 /// <summary> | 36 /// <summary> | 
| 50 /// Преобразует результат обещания к заданному типу и возвращает новое обещание. | 37 /// Преобразует результат обещания к заданному типу и возвращает новое обещание. | 
| 51 /// </summary> | 38 /// </summary> | 
| 52 IPromise<T> Cast<T>(); | 39 IPromise<T> Cast<T>(); | 
