Mercurial > pub > ImplabNet
changeset 135:656815cb7147 v2
Fixed chaining of promises with 'Then' method
author | cin |
---|---|
date | Fri, 13 Feb 2015 02:08:01 +0300 |
parents | 04d4c92d0f28 |
children | e9e7940c7d98 |
files | Implab/PromiseT.cs |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Implab/PromiseT.cs Wed Feb 11 02:12:15 2015 +0300 +++ b/Implab/PromiseT.cs Fri Feb 13 02:08:01 2015 +0300 @@ -349,18 +349,24 @@ public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error, Func<T2> cancel) { var promise = new Promise<T2>(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor<T2>(mapper, error, cancel, promise)); return promise; } public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error) { var promise = new Promise<T2>(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor<T2>(mapper, error, null, promise)); return promise; } public IPromise<T2> Then<T2>(Func<T, T2> mapper) { var promise = new Promise<T2>(); + if (mapper != null) + promise.On(Cancel, PromiseEventType.Cancelled); AddHandler(new RemapDescriptor<T2>(mapper, null, null, promise)); return promise; }