Ejemplo n.º 1
0
 public IPromise <T> ThenRace <T>(Func <IEnumerable <IPromise <T> > > chain)
 {
     return(Then(() => Promise <T> .Race(chain())));
 }
Ejemplo n.º 2
0
 private Promise Then(Func <IPromise> onFulfilled, Action <Exception> onRejected, Promise result)
 {
     return
         (Apply(
              result,
              () =>
     {
         if (onFulfilled == null)
         {
             result.Resolve();
         }
         else
         {
             onFulfilled().Then(() => result.Resolve(), result.Reject);
         }
     },
              error =>
     {
         onRejected(error);
         result.Reject(error);
     }));
 }
Ejemplo n.º 3
0
 public IPromise <IEnumerable <T> > ThenAll <T>(Func <IEnumerable <IPromise <T> > > chain)
 {
     return(Then(() => Promise <T> .All(chain())));
 }
Ejemplo n.º 4
0
 private IPromise <TNext> Then <TNext>(Func <IPromise <TNext> > onFulfilled, Action <Exception> onRejected, Promise <TNext> result)
 {
     return
         (Apply(
              result,
              () => onFulfilled().Then(nextValue => result.Resolve(nextValue), result.Reject),
              error =>
     {
         onRejected(error);
         result.Reject(error);
     }));
 }