comparison Implab/IPromiseT.cs @ 119:2573b562e328 v2

Promises rewritten, added improved version of AsyncQueue
author cin
date Sun, 11 Jan 2015 19:13:02 +0300
parents d4e38929ce36
children f75cfa58e3d4
comparison
equal deleted inserted replaced
118:e046a94eecb1 119:2573b562e328
1 using System; 1 using System;
2 2
3 namespace Implab { 3 namespace Implab {
4 public interface IPromise<T> : IPromise { 4 public interface IPromise<out T> : IPromise {
5 5
6 new T Join(); 6 new T Join();
7 7
8 new T Join(int timeout); 8 new T Join(int timeout);
9 9
10 void On(Action<T> success, Action<Exception> error, Action cancel); 10 IPromise<T> On(Action<T> success, Action<Exception> error, Action cancel);
11 11
12 void On(Action<T> success, Action<Exception> error); 12 IPromise<T> On(Action<T> success, Action<Exception> error);
13 13
14 void On(Action<T> success); 14 IPromise<T> On(Action<T> success);
15 15
16 IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error, Action cancel); 16 new IPromise<T> On(Action handler, PromiseEventType events);
17
18 IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error, Func<T2> cancel);
17 19
18 IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error); 20 IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error);
19 21
20 IPromise<T2> Then<T2>(Func<T, T2> mapper); 22 IPromise<T2> Then<T2>(Func<T, T2> mapper);
21 23
22 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error, Action cancel); 24 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error, Func<IPromise<T2>> cancel);
23 25
24 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error); 26 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error);
25 27
26 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained); 28 IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained);
27 29
28 IPromise<T> Error(Func<Exception,T> error); 30 IPromise<T2> Error<T2>(Func<Exception,T2> error);
29 31
30 new IPromise<T> Cancelled(Action handler); 32 IPromise<T2> Cancelled<T2>(Func<T2> handler);
31
32 new IPromise<T> Anyway(Action handler);
33 } 33 }
34 } 34 }