Пример #1
0
 /// <summary>
 /// Takes a function that yields an enumerable of promises.
 /// Converts to a non-value promise.
 /// Returns a promise that resolves when the first of the promises has resolved.
 /// Yields the value from the first promise that has resolved.
 /// </summary>
 public IPromise ThenRace(Func <PromisedT, IEnumerable <IPromise> > chain)
 {
     return(Then(value => Promise.Race(chain(value))));
 }
Пример #2
0
 /// <summary>
 /// Takes a function that yields an enumerable of promises.
 /// Returns a promise that resolves when the first of the promises has resolved.
 /// Yields the value from the first promise that has resolved.
 /// </summary>
 public IPromise <ConvertedT> ThenRace <ConvertedT>(Func <PromisedT, IEnumerable <IPromise <ConvertedT> > > chain)
 {
     return(Then(value => Promise <ConvertedT> .Race(chain(value))));
 }