diff Implab/PromiseExtensions.cs @ 149:eb793fbbe4ea v2

fixed promises cancellation
author cin
date Wed, 06 May 2015 17:11:27 +0300
parents 706fccb85524
children ec91a6dfa5b3
line wrap: on
line diff
--- a/Implab/PromiseExtensions.cs	Wed Apr 15 07:30:20 2015 +0300
+++ b/Implab/PromiseExtensions.cs	Wed May 06 17:11:27 2015 +0300
@@ -178,7 +178,7 @@
         public static IPromise Then(this IPromise that, Action success, Action<Exception> error, Action<Exception> cancel) {
             Safe.ArgumentNotNull(that, "that");
 
-            var d = new ActionTask(success, error, cancel);
+            var d = new ActionTask(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);
@@ -196,7 +196,7 @@
         public static IPromise<T> Then<T>(this IPromise that, Func<T> success, Func<Exception, T> error, Func<Exception, T> cancel) {
             Safe.ArgumentNotNull(that, "that");
 
-            var d = new FuncTask<T>(success, error, cancel);
+            var d = new FuncTask<T>(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);
@@ -213,7 +213,7 @@
 
         public static IPromise<T2> Then<T, T2>(this IPromise<T> that, Func<T, T2> success, Func<Exception, T2> error, Func<Exception, T2> cancel) {
             Safe.ArgumentNotNull(that, "that");
-            var d = new FuncTask<T,T2>(success, error, cancel);
+            var d = new FuncTask<T,T2>(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);
@@ -232,7 +232,7 @@
         public static IPromise Chain(this IPromise that, Func<IPromise> success, Func<Exception,IPromise> error, Func<Exception,IPromise> cancel) {
             Safe.ArgumentNotNull(that, "that");
 
-            var d = new ActionChainTask(success, error, cancel);
+            var d = new ActionChainTask(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);
@@ -250,7 +250,7 @@
         public static IPromise<T> Chain<T>(this IPromise that, Func<IPromise<T>> success, Func<Exception, IPromise<T>> error, Func<Exception, IPromise<T>> cancel) {
             Safe.ArgumentNotNull(that, "that");
 
-            var d = new FuncChainTask<T>(success, error, cancel);
+            var d = new FuncChainTask<T>(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);
@@ -267,7 +267,7 @@
 
         public static IPromise<T2> Chain<T, T2>(this IPromise<T> that, Func<T, IPromise<T2>> success, Func<Exception, IPromise<T2>> error, Func<Exception, IPromise<T2>> cancel) {
             Safe.ArgumentNotNull(that, "that");
-            var d = new FuncChainTask<T,T2>(success, error, cancel);
+            var d = new FuncChainTask<T,T2>(success, error, cancel, false);
             that.On(d.Resolve, d.Reject, d.CancelOperation);
             if (success != null)
                 d.CancellationRequested(that.Cancel);