/// <summary> /// Takes a function that yields an enumerable of promises. /// Returns a promise that resolves when the first of the promises has resolved. /// </summary> public IPromise ThenRace(Func <IEnumerable <IPromise> > chain) { return(Then(() => Promise.Race(chain()))); }
/// <summary> /// Takes a function that yields an enumerable of promises. /// Converts to a value promise. /// Returns a promise that resolves when the first of the promises has resolved. /// </summary> public IPromise <ConvertedT> ThenRace <ConvertedT>(Func <IEnumerable <IPromise <ConvertedT> > > chain) { return(Then(() => Promise <ConvertedT> .Race(chain()))); }
/// <summary> /// Chain an enumerable of promises, all of which must resolve. /// The resulting promise is resolved when all of the promises have resolved. /// It is rejected as soon as any of the promises have been rejected. /// </summary> public IPromise ThenAll(Func <IEnumerable <IPromise> > chain) { return(Then(() => Promise.All(chain()))); }