diff 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
line wrap: on
line diff
--- a/Implab/IPromiseT.cs	Sun Dec 28 16:09:03 2014 +0300
+++ b/Implab/IPromiseT.cs	Sun Jan 11 19:13:02 2015 +0300
@@ -1,34 +1,34 @@
 using System;
 
 namespace Implab {
-    public interface IPromise<T> : IPromise {
+    public interface IPromise<out T> : IPromise {
 
         new T Join();
 
         new T Join(int timeout);
 
-        void On(Action<T> success, Action<Exception> error, Action cancel);
+        IPromise<T> On(Action<T> success, Action<Exception> error, Action cancel);
         
-        void On(Action<T> success, Action<Exception> error);
+        IPromise<T> On(Action<T> success, Action<Exception> error);
 
-        void On(Action<T> success);
+        IPromise<T> On(Action<T> success);
 
-        IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error, Action cancel);
+        new IPromise<T> On(Action handler, PromiseEventType events);
+
+        IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error, Func<T2> cancel);
 
         IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception,T2> error);
 
         IPromise<T2> Then<T2>(Func<T, T2> mapper);
 
-        IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error, Action cancel);
+        IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error, Func<IPromise<T2>> cancel);
 
         IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained, Func<Exception,IPromise<T2>> error);
 
         IPromise<T2> Chain<T2>(Func<T, IPromise<T2>> chained);
 
-        IPromise<T> Error(Func<Exception,T> error);
+        IPromise<T2> Error<T2>(Func<Exception,T2> error);
 
-        new IPromise<T> Cancelled(Action handler);
-
-        new IPromise<T> Anyway(Action handler);
+        IPromise<T2> Cancelled<T2>(Func<T2> handler);
     }
 }