/// <summary> /// Callback to be executed when the reported progress changes /// </summary> /// <param name="callback">Callback to be executed with the progress [0, 100] and the message</param> /// <returns> /// The current instance for chaining additional calls /// </returns> public IPromise <T> Progress(Action <int, string> callback) { if (_status == Status.Pending) { LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Progress)); } return(this); }
IPromise IPromise.Done(Action <object> callback) { if (_status == Status.Resolved) { callback.Invoke(_arg); } else { LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Success)); } return(this); }
/// <summary> /// Callback to be executed when the promise encounters an error /// </summary> /// <param name="callback">Callback to be executed with the exception of the promise</param> /// <returns>The current instance for chaining additional calls</returns> public IPromise <T> Fail(Action <Exception> callback) { if (_status == Status.Rejected) { callback.Invoke((Exception)_arg); } else { LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Failure)); } return(this); }
/// <summary> /// Callback to be executed when the promise completes regardless of whether an error occurred /// </summary> /// <param name="callback">Callback to be executed</param> /// <returns>The current instance for chaining additional calls</returns> public IPromise <T> Always(Action callback) { if (_status != Status.Pending) { callback.Invoke(); } else { LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Always)); } return(this); }
internal void QuickAddAttribute(ILinkedAnnotation attr) { LinkedListOps.Add(ref _lastAttr, attr); }
internal void QuickAddElement(ILinkedElement elem) { _content = LinkedListOps.Add(_content as ILinkedElement, elem); }