Class Promise
Promise-related helpers.
Inherited Members
Namespace: UnityFx.Async.Promises
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public static class Promise
Methods
| Improve this Doc View SourceAll(IEnumerable<IAsyncOperation>)
Returns a promise that resolves when all of the promises in the enumerable argument have resolved.
Declaration
public static IAsyncOperation All(IEnumerable<IAsyncOperation> ops)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<IAsyncOperation> | ops | Operations to wait for. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when all specified promises are resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
| Improve this Doc View SourceAll(IAsyncOperation[])
Returns a promise that resolves when all of the promises in the enumerable argument have resolved.
Declaration
public static IAsyncOperation All(params IAsyncOperation[] ops)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation[] | ops | Operations to wait for. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when all specified promises are resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
| Improve this Doc View SourceRace(IEnumerable<IAsyncOperation>)
Returns a promise that resolves when any of the promises in the enumerable argument have resolved.
Declaration
public static IAsyncOperation Race(IEnumerable<IAsyncOperation> ops)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<IAsyncOperation> | ops | Operations to wait for. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when any of the specified promises is resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
| Improve this Doc View SourceRace(IAsyncOperation[])
Returns a promise that resolves when any of the promises in the enumerable argument have resolved.
Declaration
public static IAsyncOperation Race(params IAsyncOperation[] ops)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation[] | ops | Operations to wait for. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when any of the specified promises is resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
| Improve this Doc View SourceRejected()
Creates a promise that's already been rejected.
Declaration
public static IAsyncOperation Rejected()
Returns
| Type | Description |
|---|---|
| IAsyncOperation |
See Also
| Improve this Doc View SourceRejected(Exception)
Creates a promise that's already been rejected with the specified Exception.
Declaration
public static IAsyncOperation Rejected(Exception e)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | e |
Returns
| Type | Description |
|---|---|
| IAsyncOperation |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
See Also
| Improve this Doc View SourceRejected(String)
Creates a promise that's already been rejected with the specified error message.
Declaration
public static IAsyncOperation Rejected(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| String | message |
Returns
| Type | Description |
|---|---|
| IAsyncOperation |
See Also
| Improve this Doc View SourceResolved()
Creates a promise that's already been resolved.
Declaration
public static IAsyncOperation Resolved()
Returns
| Type | Description |
|---|---|
| IAsyncOperation |
See Also
| Improve this Doc View SourceResolved<TResult>(TResult)
Creates a promise that's already been resolved with the specified value.
Declaration
public static IAsyncOperation<TResult> Resolved<TResult>(TResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| TResult | result |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
| Improve this Doc View SourceSequence(IEnumerable<Func<IAsyncOperation>>)
Chain a number of operations using promises.
Declaration
public static IAsyncOperation Sequence(IEnumerable<Func<IAsyncOperation>> ops)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Func<IAsyncOperation>> | ops | Functions each of which starts an async operation and yields a promise. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when all promises in the sequence are resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
| Improve this Doc View SourceSequence(Func<IAsyncOperation>[])
Chain a number of operations using promises.
Declaration
public static IAsyncOperation Sequence(params Func<IAsyncOperation>[] ops)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<IAsyncOperation>[] | ops | Functions each of which starts an async operation and yields a promise. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | An operation that completes when all promises in the sequence are resolved. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| ArgumentException | Thrown if the |
See Also
Events
| Improve this Doc View SourceUnhandledException
Event raised for unhandled exceptions. For this to work you have to complete your promises with a call to Done().
Declaration
public static event EventHandler<ExceptionEventArgs> UnhandledException
Event Type
| Type | Description |
|---|---|
| System.EventHandler<ExceptionEventArgs> |