##// END OF EJS Templates
Added awaiters to promises...
Added awaiters to promises Added static methods to Promise Resolve, Reject, All. Updated promise helpers

File last commit:

r248:5cb4826c2c2a v3
r248:5cb4826c2c2a v3
Show More
PromiseFuncReaction`1.cs
55 lines | 2.1 KiB | text/x-csharp | CSharpLexer
/ Implab / PromiseFuncReaction`1.cs
cin
working on promises
r247 using System;
using System.Diagnostics;
namespace Implab {
class PromiseFuncReaction<TRet> : PromiseReaction {
readonly Deferred<TRet> m_next;
cin
Added awaiters to promises...
r248 public IPromise<TRet> Promise {
get { return m_next.Promise; }
}
public PromiseFuncReaction(Func<TRet> fulfilled, Func<Exception, TRet> rejected, IDispatcher dispatcher) : base(dispatcher) {
m_next = new Deferred<TRet>(dispatcher);
cin
working on promises
r247 if (fulfilled != null)
cin
Added awaiters to promises...
r248 FulfilHandler = PromiseHandler.Create(fulfilled, m_next);
cin
working on promises
r247
if (rejected != null)
cin
Added awaiters to promises...
r248 RejectHandler = PromiseHandler.Create(rejected, m_next);
cin
working on promises
r247 }
cin
Added awaiters to promises...
r248 public PromiseFuncReaction(Func<IPromise<TRet>> fulfilled, Func<Exception, IPromise<TRet>> rejected, IDispatcher dispatcher) : base(dispatcher) {
m_next = new Deferred<TRet>(dispatcher);
cin
working on promises
r247 if (fulfilled != null)
cin
Added awaiters to promises...
r248 FulfilHandler = PromiseHandler.Create(fulfilled, m_next);
cin
working on promises
r247 if (rejected != null)
cin
Added awaiters to promises...
r248 RejectHandler = PromiseHandler.Create(rejected, m_next);
cin
working on promises
r247 }
cin
Added awaiters to promises...
r248 public PromiseFuncReaction(Func<TRet> fulfilled, Func<Exception, IPromise<TRet>> rejected, IDispatcher dispatcher) : base(dispatcher) {
m_next = new Deferred<TRet>(dispatcher);
cin
working on promises
r247 if (fulfilled != null)
cin
Added awaiters to promises...
r248 FulfilHandler = PromiseHandler.Create(fulfilled, m_next);
cin
working on promises
r247 if (rejected != null)
cin
Added awaiters to promises...
r248 RejectHandler = PromiseHandler.Create(rejected, m_next);
cin
working on promises
r247 }
cin
Added awaiters to promises...
r248 public PromiseFuncReaction(Func<IPromise<TRet>> fulfilled, Func<Exception, TRet> rejected, IDispatcher dispatcher) : base(dispatcher) {
m_next = new Deferred<TRet>(dispatcher);
if (fulfilled != null)
FulfilHandler = PromiseHandler.Create(fulfilled, m_next);
cin
working on promises
r247
cin
Added awaiters to promises...
r248 if (rejected != null)
RejectHandler = PromiseHandler.Create(rejected, m_next);
}
cin
working on promises
r247
protected override void DefaultReject(Exception reason) {
m_next.Reject(reason);
}
protected override void DefaultResolve() {
throw new NotImplementedException();
}
}
}