Interface IPromise<T>
Represents a promise that a result of the specified type will be provided at some point in the future
Inherited Members
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public interface IPromise<T> : IPromise, ICancelable
Type Parameters
Name | Description |
---|---|
T |
Remarks
A promise is very similar to a System.Threading.Tasks.Task and can be awaited just like a task. The API of a promise is very similar to that of a JQuery Promise
Properties
| Improve this Doc View SourceValue
The result of the promise. Only valid if IsResolved is true
Declaration
T Value { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceAlways(Action)
Callback to be executed when the promise completes regardless of whether an error occurred
Declaration
IPromise<T> Always(Action callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action | callback | Callback to be executed |
Returns
Type | Description |
---|---|
IPromise<T> | The current instance for chaining additional calls |
Done(Action<T>)
Callback to be executed when the promise completes successfully
Declaration
IPromise<T> Done(Action<T> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | callback | Callback to be executed with the result of the promise |
Returns
Type | Description |
---|---|
IPromise<T> | The current instance for chaining additional calls |
Fail(Action<Exception>)
Callback to be executed when the promise encounters an error
Declaration
IPromise<T> Fail(Action<Exception> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Exception> | callback | Callback to be executed with the exception of the promise |
Returns
Type | Description |
---|---|
IPromise<T> | The current instance for chaining additional calls |
Progress(Action<Int32, String>)
Callback to be executed when the reported progress changes
Declaration
IPromise<T> Progress(Action<int, string> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Int32, System.String> | callback | Callback to be executed with the progress [0, 100] and the message |
Returns
Type | Description |
---|---|
IPromise<T> | The current instance for chaining additional calls |