Mercurial > pub > ImplabNet
diff Implab/IPromise.cs @ 242:cbe10ac0731e v3
Working on promises
author | cin |
---|---|
date | Wed, 24 Jan 2018 03:03:21 +0300 |
parents | ec91a6dfa5b3 |
children | b1e0ffdf3451 |
line wrap: on
line diff
--- a/Implab/IPromise.cs Tue Jan 23 19:39:21 2018 +0300 +++ b/Implab/IPromise.cs Wed Jan 24 03:03:21 2018 +0300 @@ -9,42 +9,29 @@ /// <summary> /// Тип результата, получаемого через данное обещание. /// </summary> - Type PromiseType { get; } + Type ResultType { get; } /// <summary> /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено. /// </summary> - bool IsResolved { get; } + bool IsFulfilled { get; } - /// <summary> - /// Обещание было отменено. - /// </summary> - bool IsCancelled { get; } + bool IsRejected { get; } + + bool IsResolved { get; } /// <summary> /// Исключение возникшее в результате выполнения обещания, либо причина отмены. /// </summary> - Exception Error { get; } + Exception RejectReason { 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); + void On(Action success, Action<Exception> error); /// <summary> /// Преобразует результат обещания к заданному типу и возвращает новое обещание.