コード例 #1
0
        /// <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;
            }));
        }
コード例 #2
0
 /// <summary>Provides methods to run when this promise completes.</summary>
 public Promise then(PromiseDelegate onFulfil, PromiseDelegateVoid onReject)
 {
     return(then(onFulfil, toDelegate(onReject)));
 }
コード例 #3
0
 /// <summary>Adds a rejection handler.</summary>
 public Promise @catch(PromiseDelegateVoid onReject)
 {
     return(then((PromiseDelegate)null, toDelegate(onReject)));
 }
コード例 #4
0
 /// <summary>Provides methods to run when this promise completes.</summary>
 public Promise then(PromiseDelegateVoid onFulfil)
 {
     return(then(toDelegate(onFulfil), (Promise)null));
 }