comparison Implab/IPromiseT.cs @ 76:c761fc982e1d v2

Refactoring of the IPromise<T> interface Added tests
author cin
date Wed, 10 Sep 2014 17:53:05 +0400
parents 4439140706d0
children a43745f81f10
comparison
equal deleted inserted replaced
75:4439140706d0 76:c761fc982e1d
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 5
6 namespace Implab { 6 namespace Implab {
7 public interface IPromise<T>: IPromise { 7 public interface IPromise<T> : IPromise {
8 8
9 new T Join(); 9 new T Join();
10 10
11 new T Join(int timeout); 11 new T Join(int timeout);
12
13 void Last(ResultHandler<T> success, ErrorHandler error, Action cancel);
14
15 void Last(ResultHandler<T> success, ErrorHandler error);
16
17 void Last(ResultHandler<T> success);
12 18
13 IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error, Action cancel); 19 IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error, Action cancel);
14 20
15 IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error); 21 IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error);
16 22
17 IPromise<T> Then(ResultHandler<T> success); 23 IPromise<T> Then(ResultHandler<T> success);
18 24
19 void Last(ResultHandler<T> success, ErrorHandler error, Action cancel); 25 IPromise<T2> Then<T2>(ResultMapper<T, T2> mapper, ErrorHandler<T2> error, Action cancel);
20 void Last(ResultHandler<T> success, ErrorHandler error); 26
21 void Last(ResultHandler<T> success); 27 IPromise<T2> Then<T2>(ResultMapper<T, T2> mapper, ErrorHandler<T2> error);
28
29 IPromise<T2> Then<T2>(ResultMapper<T, T2> mapper);
30
31 IPromise<T2> Chain<T2>(ResultMapper<T, IPromise<T2>> chained, ErrorHandler<IPromise<T2>> error, Action cancel);
32
33 IPromise<T2> Chain<T2>(ResultMapper<T, IPromise<T2>> chained, ErrorHandler<IPromise<T2>> error);
34
35 IPromise<T2> Chain<T2>(ResultMapper<T, IPromise<T2>> chained);
22 36
23 IPromise<T> Error(ErrorHandler<T> error); 37 IPromise<T> Error(ErrorHandler<T> error);
24 38
25 IPromise<T2> Then<T2>(ResultMapper<T,T2> mapper, ErrorHandler<T> error);
26
27 IPromise<T2> Then<T2>(ResultMapper<T,T2> mapper);
28
29 IPromise<T2> Then<T2>(ChainedOperation<T, T2> chained, ErrorHandler<T> error);
30
31 IPromise<T2> Then<T2>(ChainedOperation<T, T2> chained);
32
33 new IPromise<T> Cancelled(Action handler); 39 new IPromise<T> Cancelled(Action handler);
34 40
35 new IPromise<T> Finally(Action handler); 41 new IPromise<T> Anyway(Action handler);
36 } 42 }
37 } 43 }