@@ -349,18 +349,24 namespace Implab { | |||||
349 |
|
349 | |||
350 | public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error, Func<T2> cancel) { |
|
350 | public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error, Func<T2> cancel) { | |
351 | var promise = new Promise<T2>(); |
|
351 | var promise = new Promise<T2>(); | |
|
352 | if (mapper != null) | |||
|
353 | promise.On(Cancel, PromiseEventType.Cancelled); | |||
352 | AddHandler(new RemapDescriptor<T2>(mapper, error, cancel, promise)); |
|
354 | AddHandler(new RemapDescriptor<T2>(mapper, error, cancel, promise)); | |
353 | return promise; |
|
355 | return promise; | |
354 | } |
|
356 | } | |
355 |
|
357 | |||
356 | public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error) { |
|
358 | public IPromise<T2> Then<T2>(Func<T, T2> mapper, Func<Exception, T2> error) { | |
357 | var promise = new Promise<T2>(); |
|
359 | var promise = new Promise<T2>(); | |
|
360 | if (mapper != null) | |||
|
361 | promise.On(Cancel, PromiseEventType.Cancelled); | |||
358 | AddHandler(new RemapDescriptor<T2>(mapper, error, null, promise)); |
|
362 | AddHandler(new RemapDescriptor<T2>(mapper, error, null, promise)); | |
359 | return promise; |
|
363 | return promise; | |
360 | } |
|
364 | } | |
361 |
|
365 | |||
362 | public IPromise<T2> Then<T2>(Func<T, T2> mapper) { |
|
366 | public IPromise<T2> Then<T2>(Func<T, T2> mapper) { | |
363 | var promise = new Promise<T2>(); |
|
367 | var promise = new Promise<T2>(); | |
|
368 | if (mapper != null) | |||
|
369 | promise.On(Cancel, PromiseEventType.Cancelled); | |||
364 | AddHandler(new RemapDescriptor<T2>(mapper, null, null, promise)); |
|
370 | AddHandler(new RemapDescriptor<T2>(mapper, null, null, promise)); | |
365 | return promise; |
|
371 | return promise; | |
366 | } |
|
372 | } |
General Comments 0
You need to be logged in to leave comments.
Login now