Auto status change to "Under Review"
@@ -13,6 +13,12 | |||
|
13 | 13 | |
|
14 | 14 | Running, |
|
15 | 15 | |
|
16 | Suspending, | |
|
17 | ||
|
18 | Suspended, | |
|
19 | ||
|
20 | Resuming, | |
|
21 | ||
|
16 | 22 | Stopping, |
|
17 | 23 | |
|
18 | 24 | Failed, |
@@ -263,6 +263,8 namespace Implab { | |||
|
263 | 263 | |
|
264 | 264 | public static IPromise<T2> Then<T, T2>(this IPromise<T> that, Func<T, T2> success, Func<Exception, T2> error, Func<Exception, T2> cancel) { |
|
265 | 265 | Safe.ArgumentNotNull(that, "that"); |
|
266 | Safe.ArgumentNotNull(success, "success"); | |
|
267 | ||
|
266 | 268 | var d = new FuncTask<T, T2>(success, error, cancel, false); |
|
267 | 269 | that.On(d.Resolve, d.Reject, d.CancelOperation); |
|
268 | 270 | d.CancellationRequested(that.Cancel); |
@@ -427,6 +429,13 namespace Implab { | |||
|
427 | 429 | |
|
428 | 430 | #endregion |
|
429 | 431 | |
|
432 | public static IPromise<T2> Guard<T, T2>(this IPromise<T> that, Func<IPromise<T>, IPromise<T2>> continuation, Action<T> cleanup) { | |
|
433 | Safe.ArgumentNotNull(that, "that"); | |
|
434 | Safe.ArgumentNotNull(continuation, "continuation"); | |
|
435 | return continuation(that).Error((err) => { | |
|
436 | that.On(cleanup); | |
|
437 | }, true); | |
|
438 | } | |
|
430 | 439 | |
|
431 | 440 | #if NET_4_5 |
|
432 | 441 | |
@@ -442,6 +451,24 namespace Implab { | |||
|
442 | 451 | return new PromiseAwaiter(that); |
|
443 | 452 | } |
|
444 | 453 | |
|
454 | public static IPromise BoundCancellationToken(this IPromise that, CancellationToken ct) { | |
|
455 | Safe.ArgumentNotNull(that, "that"); | |
|
456 | ct.Register(that.Cancel); | |
|
457 | return that.Then(null, null, (err) => { | |
|
458 | ct.ThrowIfCancellationRequested(); | |
|
459 | throw new PromiseTransientException(err); | |
|
460 | }); | |
|
461 | } | |
|
462 | ||
|
463 | public static IPromise<T> BoundCancellationToken<T>(this IPromise<T> that, CancellationToken ct) { | |
|
464 | Safe.ArgumentNotNull(that, "that"); | |
|
465 | ct.Register(that.Cancel); | |
|
466 | return that.Then(null, null, (err) => { | |
|
467 | ct.ThrowIfCancellationRequested(); | |
|
468 | throw new PromiseTransientException(err); | |
|
469 | }); | |
|
470 | } | |
|
471 | ||
|
445 | 472 | #endif |
|
446 | 473 | } |
|
447 | 474 | } |
General Comments 3
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now