Mercurial > pub > ImplabNet
diff Implab/IPromise.cs @ 192:f1da3afc3521 release v2.1
Слияние с v2
author | cin |
---|---|
date | Fri, 22 Apr 2016 13:10:34 +0300 |
parents | ec91a6dfa5b3 |
children | cbe10ac0731e |
line wrap: on
line diff
--- a/Implab/IPromise.cs Wed Sep 03 18:34:02 2014 +0400 +++ b/Implab/IPromise.cs Fri Apr 22 13:10:34 2016 +0300 @@ -5,32 +5,61 @@ namespace Implab { public interface IPromise: ICancellable { - /// <summary> - /// Check whereather the promise has no more than one dependent promise. - /// </summary> - bool IsExclusive { - get; - } /// <summary> /// Тип результата, получаемого через данное обещание. /// </summary> Type PromiseType { get; } + /// <summary> + /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено. + /// </summary> bool IsResolved { get; } + /// <summary> + /// Обещание было отменено. + /// </summary> bool IsCancelled { get; } - IPromise Then(Action success,ErrorHandler error); - IPromise Then(Action success); - IPromise Error(ErrorHandler error); - IPromise Anyway(Action handler); - IPromise Finally(Action handler); - IPromise Cancelled(Action handler); + /// <summary> + /// Исключение возникшее в результате выполнения обещания, либо причина отмены. + /// </summary> + Exception Error { get; } + /// <summary> + /// Adds specified listeners to the current promise. + /// </summary> + /// <param name="success">The handler called on the successful promise completion.</param> + /// <param name="error">The handler is called if an error while completing the promise occurred.</param> + /// <param name="cancel">The handler is called in case of promise cancellation.</param> + /// <returns>The current promise.</returns> + IPromise On(Action success, Action<Exception> error, Action<Exception> cancel); + IPromise On(Action success, Action<Exception> error); + IPromise On(Action success); + + /// <summary> + /// Adds specified listeners to the current promise. + /// </summary> + /// <param name="handler">The handler called on the specified events.</param> + /// <param name = "events">The combination of flags denoting the events for which the + /// handler shoud be called.</param> + /// <returns>The current promise.</returns> + IPromise On(Action handler, PromiseEventType events); + + /// <summary> + /// Преобразует результат обещания к заданному типу и возвращает новое обещание. + /// </summary> IPromise<T> Cast<T>(); + /// <summary> + /// Синхронизирует текущий поток с обещанием. + /// </summary> void Join(); + /// <summary> + /// Синхронизирует текущий поток с обещанием. + /// </summary> + /// <param name="timeout">Время ожидания, по его истечению возникнет исключение.</param> + /// <exception cref="TimeoutException">Превышено время ожидания.</exception> void Join(int timeout); }