/// <summary>Creates a proxy delegate for one which returns void.</summrry> private PromiseDelegate toDelegate(PromiseDelegateVoid deleg) { if (deleg == null) { return(null); } return(new PromiseDelegate(delegate(object x){ deleg(x); return null; })); }
/// <summary>Provides methods to run when this promise completes.</summary> public Promise then(PromiseDelegate onFulfil, PromiseDelegateVoid onReject) { return(then(onFulfil, toDelegate(onReject))); }
/// <summary>Adds a rejection handler.</summary> public Promise @catch(PromiseDelegateVoid onReject) { return(then((PromiseDelegate)null, toDelegate(onReject))); }
/// <summary>Provides methods to run when this promise completes.</summary> public Promise then(PromiseDelegateVoid onFulfil) { return(then(toDelegate(onFulfil), (Promise)null)); }