diff Implab/PromiseExtensions.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 279e226dffdd
line wrap: on
line diff
--- a/Implab/PromiseExtensions.cs	Wed Sep 10 11:17:37 2014 +0400
+++ b/Implab/PromiseExtensions.cs	Wed Sep 10 17:53:05 2014 +0400
@@ -14,12 +14,10 @@
 
             var p = new SyncContextPromise<T>(context, that, true);
 
-            that.Then(
-                x => p.Resolve(x),
-                e => {
-                    p.Reject(e);
-                    return default(T);
-                }
+            that.Last(
+                p.Resolve,
+                p.Reject,
+                p.Cancel
             );
             return p;
         }
@@ -30,12 +28,10 @@
 
             var p = new SyncContextPromise<T>(context, that, true);
 
-            that.Then(
-                x => p.Resolve(x),
-                e => {
-                    p.Reject(e);
-                    return default(T);
-                }
+            that.Last(
+                p.Resolve,
+                p.Reject,
+                p.Cancel
             );
             return p;
         }