public IPromise Then(PromiseAction <object> success, PromiseAction <object> failure = null) { NextDeferred = new Deferred(); Success = new Func <object, IPromise>((parm) => { success(parm); return(null); }); if (failure != null) { Failure = new Func <object, IPromise>((parm) => { failure(parm); return(null); }); } return(NextDeferred); }
/// <summary> /// Chains delegates that will be executed on success or failure of a promise. /// </summary> /// /// <param name="success"> /// The delegate to call upon successful resolution of the promise. /// </param> /// <param name="failure"> /// (optional) The delegate to call upon unsuccessful resolution of the promise. /// </param> /// /// <returns> /// A new promise which will resolve when this promise has resolved. /// </returns> public IPromise Then(PromiseAction<object> success, PromiseAction<object> failure = null) { return Deferred.Then(success, failure); }
/// <summary> /// Bind delegates to the success or failure of a promise /// </summary> /// /// <param name="success"> /// The success delegate /// </param> /// <param name="failure"> /// (optional) the failure delegate /// </param> /// /// <returns> /// A new promise that resolves when the current promise resolves. /// </returns> public IPromise Then(PromiseAction <T> success, PromiseAction <T> failure = null) { return(base.Then(success, failure)); }
/// <summary> /// Chains delegates that will be executed on success or failure of a promise. /// </summary> /// /// <param name="success"> /// The delegate to call upon successful resolution of the promise. /// </param> /// <param name="failure"> /// (optional) The delegate to call upon unsuccessful resolution of the promise. /// </param> /// /// <returns> /// A new promise which will resolve when this promise has resolved. /// </returns> public IPromise Then(PromiseAction <object> success, PromiseAction <object> failure = null) { return(Deferred.Then(success, failure)); }
/// <summary> /// Chains delegates that will be executed on success or failure of a promise. /// </summary> /// /// <param name="success"> /// The delegate to call upon successful resolution of the promise. /// </param> /// <param name="failure"> /// (optional) The delegate to call upon unsuccessful resolution of the promise. /// </param> /// /// <returns> /// A new promise which will resolve when this promise has resolved. /// </returns> public IPromise Then(PromiseAction<object> success, PromiseAction<object> failure = null) { lock (Locker) { var deferred = GetNextDeferred(); Success = new Func<object, IPromise>((parm) => { success(parm); return null; }); if (failure != null) { Failure = new Func<object, IPromise>((parm) => { failure(parm); return null; }); } return deferred; } }
/// <summary> /// Chains delegates that will be executed on success or failure of a promise. /// </summary> /// /// <param name="success"> /// The delegate to call upon successful resolution of the promise. /// </param> /// <param name="failure"> /// (optional) The delegate to call upon unsuccessful resolution of the promise. /// </param> /// /// <returns> /// A new promise which will resolve when this promise has resolved. /// </returns> IPromise IPromise.Then(PromiseAction <object> success, PromiseAction <object> failure) { return(deferred.Then(success, failure)); }