예제 #1
0
파일: Promise.cs 프로젝트: jorik041/UniMap
 /// <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
파일: Promise.cs 프로젝트: jorik041/UniMap
 /// <summary>
 /// Return a new promise with a different value.
 /// May also change the type of the value.
 /// </summary>
 public IPromise <ConvertedT> Then <ConvertedT>(Func <PromisedT, ConvertedT> transform)
 {
     //            Argument.NotNull(() => transform);
     return(Then(value => Promise <ConvertedT> .Resolved(transform(value))));
 }
예제 #3
0
파일: Promise.cs 프로젝트: jorik041/UniMap
 /// <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))));
 }
예제 #4
0
파일: Promise.cs 프로젝트: jorik041/UniMap
 /// <summary>
 /// Complete the promise. Adds a default error handler.
 /// </summary>
 public void Done()
 {
     Catch(ex =>
           Promise.PropagateUnhandledException(this, ex)
           );
 }