Class PromiseExtensions
Promise extensions for IAsyncOperation.
Inherited Members
Namespace: UnityFx.Async.Promises
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public static class PromiseExtensions
Methods
| Improve this Doc View SourceCatch(IAsyncOperation, Action<Exception>)
Schedules a callback to be executed after the promise has been rejected.
Declaration
public static IAsyncOperation Catch(this IAsyncOperation op, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Action<Exception> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
Catch<TException>(IAsyncOperation, Action<TException>)
Schedules a callback to be executed after the promise has been rejected.
Declaration
public static IAsyncOperation Catch<TException>(this IAsyncOperation op, Action<TException> errorCallback)where TException : Exception
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Action<TException> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TException |
See Also
Done(IAsyncOperation)
Routes unhendled errors to UnhandledException.
Declaration
public static void Done(this IAsyncOperation op)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
See Also
Done(IAsyncOperation, Action)
Schedules a callback to be executed after the promise chain has completed. Routes unhendled errors to UnhandledException.
Declaration
public static void Done(this IAsyncOperation op, Action successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| Action | successCallback | The callback to be executed when the promise has resolved. |
See Also
Done(IAsyncOperation, Action, Action<Exception>)
Schedules a callback to be executed after the promise chain has completed. Routes unhendled errors to UnhandledException.
Declaration
public static void Done(this IAsyncOperation op, Action successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| Action | successCallback | The callback to be executed when the promise has resolved. |
| System.Action<Exception> | errorCallback | The callback to be executed when the promise was rejected. |
See Also
Done<TResult>(IAsyncOperation<TResult>, Action<TResult>)
Schedules a callback to be executed after the promise chain has completed. Routes unhendled errors to UnhandledException.
Declaration
public static void Done<TResult>(this IAsyncOperation<TResult> op, Action<TResult> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Action<TResult> | successCallback | The callback to be executed when the promise has resolved. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Done<TResult>(IAsyncOperation<TResult>, Action<TResult>, Action<Exception>)
Schedules a callback to be executed after the promise chain has completed. Routes unhendled errors to UnhandledException.
Declaration
public static void Done<TResult>(this IAsyncOperation<TResult> op, Action<TResult> successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Action<TResult> | successCallback | The callback to be executed when the promise has resolved. |
| System.Action<Exception> | errorCallback | The callback to be executed when the promise was rejected. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Finally(IAsyncOperation, Action)
Schedules a callback to be executed after the promise has completed.
Declaration
public static IAsyncOperation Finally(this IAsyncOperation op, Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| Action | action | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
| Improve this Doc View SourceRebind<TResult>(IAsyncOperation, Func<TResult>)
Transforms the promise result to another type.
Declaration
public static IAsyncOperation<TResult> Rebind<TResult>(this IAsyncOperation op, Func<TResult> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<TResult> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TResult> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
| Improve this Doc View SourceRebind<TResult, TNewResult>(IAsyncOperation<TResult>, Func<TResult, TNewResult>)
Transforms the promise result to another type.
Declaration
public static IAsyncOperation<TNewResult> Rebind<TResult, TNewResult>(this IAsyncOperation<TResult> op, Func<TResult, TNewResult> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<TResult, TNewResult> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TNewResult> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult | |
| TNewResult |
See Also
| Improve this Doc View SourceThen(IAsyncOperation, Action)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation Then(this IAsyncOperation op, Action successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| Action | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
Then(IAsyncOperation, Action, Action<Exception>)
Schedules a callbacks to be executed after the operation has been resolved.
Declaration
public static IAsyncOperation Then(this IAsyncOperation op, Action successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| Action | successCallback | The callback to be executed when the operation has succeeded. |
| System.Action<Exception> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
Then(IAsyncOperation, Func<IAsyncOperation>)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation Then(this IAsyncOperation op, Func<IAsyncOperation> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<IAsyncOperation> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the operation returned by |
See Also
Then(IAsyncOperation, Func<IAsyncOperation>, Action<Exception>)
Schedules a callbacks to be executed after the operation has been resolved.
Declaration
public static IAsyncOperation Then(this IAsyncOperation op, Func<IAsyncOperation> successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<IAsyncOperation> | successCallback | The callback to be executed when the operation has succeeded. |
| System.Action<Exception> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the operation returned by |
See Also
Then<TResult>(IAsyncOperation, Func<IAsyncOperation<TResult>>)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation<TResult> Then<TResult>(this IAsyncOperation op, Func<IAsyncOperation<TResult>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<IAsyncOperation<TResult>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TResult> | Returns a continuation operation that completes after both source operation and the operation returned by |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Then<TResult>(IAsyncOperation<TResult>, Action<TResult>)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation Then<TResult>(this IAsyncOperation<TResult> op, Action<TResult> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Action<TResult> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Then<TResult>(IAsyncOperation<TResult>, Action<TResult>, Action<Exception>)
Schedules a callbacks to be executed after the operation has been resolved.
Declaration
public static IAsyncOperation Then<TResult>(this IAsyncOperation<TResult> op, Action<TResult> successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Action<TResult> | successCallback | The callback to be executed when the operation has succeeded. |
| System.Action<Exception> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Then<TResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation>)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation Then<TResult>(this IAsyncOperation<TResult> op, Func<TResult, IAsyncOperation> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<TResult, IAsyncOperation> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the operation returned by |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Then<TResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation>, Action<Exception>)
Schedules a callbacks to be executed after the operation has been resolved.
Declaration
public static IAsyncOperation Then<TResult>(this IAsyncOperation<TResult> op, Func<TResult, IAsyncOperation> successCallback, Action<Exception> errorCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<TResult, IAsyncOperation> | successCallback | The callback to be executed when the operation has succeeded. |
| System.Action<Exception> | errorCallback | The callback to be executed when the operation has faulted/was canceled. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the operation returned by |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
Then<TResult, TNewResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation<TNewResult>>)
Schedules a callback to be executed after the promise has been resolved.
Declaration
public static IAsyncOperation<TNewResult> Then<TResult, TNewResult>(this IAsyncOperation<TResult> op, Func<TResult, IAsyncOperation<TNewResult>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<TResult, IAsyncOperation<TNewResult>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TNewResult> | Returns a continuation operation that completes after both source operation and the operation returned by |
Type Parameters
| Name | Description |
|---|---|
| TResult | |
| TNewResult |
See Also
ThenAll(IAsyncOperation, Func<IEnumerable<IAsyncOperation>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation ThenAll(this IAsyncOperation op, Func<IEnumerable<IAsyncOperation>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<IAsyncOperation>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
| Improve this Doc View SourceThenAll<T>(IAsyncOperation, Func<IEnumerable<IAsyncOperation<T>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation<T[]> ThenAll<T>(this IAsyncOperation op, Func<IEnumerable<IAsyncOperation<T>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<IAsyncOperation<T>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<T[]> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| T |
See Also
| Improve this Doc View SourceThenAll<T>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation ThenAll<T>(this IAsyncOperation<T> op, Func<T, IEnumerable<IAsyncOperation>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<T> | op | An operation to be continued. |
| System.Func<T, System.Collections.Generic.IEnumerable<IAsyncOperation>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| T |
See Also
| Improve this Doc View SourceThenAll<T, U>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation<U>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the specified objects in an array have completed.
Declaration
public static IAsyncOperation<U[]> ThenAll<T, U>(this IAsyncOperation<T> op, Func<T, IEnumerable<IAsyncOperation<U>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<T> | op | An operation to be continued. |
| System.Func<T, System.Collections.Generic.IEnumerable<IAsyncOperation<U>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<U[]> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| T | |
| U |
See Also
| Improve this Doc View SourceThenAny(IAsyncOperation, Func<IEnumerable<IAsyncOperation>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after any of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation ThenAny(this IAsyncOperation op, Func<IEnumerable<IAsyncOperation>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<IAsyncOperation>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
See Also
| Improve this Doc View SourceThenAny<TResult>(IAsyncOperation, Func<IEnumerable<IAsyncOperation<TResult>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after any of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation<TResult> ThenAny<TResult>(this IAsyncOperation op, Func<IEnumerable<IAsyncOperation<TResult>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<IAsyncOperation<TResult>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TResult> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
| Improve this Doc View SourceThenAny<TResult>(IAsyncOperation<TResult>, Func<TResult, IEnumerable<IAsyncOperation>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after any of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation ThenAny<TResult>(this IAsyncOperation<TResult> op, Func<TResult, IEnumerable<IAsyncOperation>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<TResult, System.Collections.Generic.IEnumerable<IAsyncOperation>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
See Also
| Improve this Doc View SourceThenAny<T, TResult>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation<TResult>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after any of the operations in the callback return value have completed.
Declaration
public static IAsyncOperation<TResult> ThenAny<T, TResult>(this IAsyncOperation<T> op, Func<T, IEnumerable<IAsyncOperation<TResult>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<T> | op | An operation to be continued. |
| System.Func<T, System.Collections.Generic.IEnumerable<IAsyncOperation<TResult>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation<TResult> | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| T | |
| TResult |
See Also
| Improve this Doc View SourceThenSequence(IAsyncOperation, Func<IEnumerable<Func<IAsyncOperation>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback have completed.
Declaration
public static IAsyncOperation ThenSequence(this IAsyncOperation op, Func<IEnumerable<Func<IAsyncOperation>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<System.Func<IAsyncOperation>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
ThenSequence(IAsyncOperation, Func<Func<IAsyncOperation>[]>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback have completed.
Declaration
public static IAsyncOperation ThenSequence(this IAsyncOperation op, Func<Func<IAsyncOperation>[]> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | op | An operation to be continued. |
| System.Func<System.Func<IAsyncOperation>[]> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
ThenSequence<TResult>(IAsyncOperation<TResult>, Func<IEnumerable<Func<IAsyncOperation>>>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback have completed.
Declaration
public static IAsyncOperation ThenSequence<TResult>(this IAsyncOperation<TResult> op, Func<IEnumerable<Func<IAsyncOperation>>> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<System.Collections.Generic.IEnumerable<System.Func<IAsyncOperation>>> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |
ThenSequence<TResult>(IAsyncOperation<TResult>, Func<Func<IAsyncOperation>[]>)
Schedules a callback to be executed after the promise has been resolved. The resulting operation will complete after all of the operations in the callback have completed.
Declaration
public static IAsyncOperation ThenSequence<TResult>(this IAsyncOperation<TResult> op, Func<Func<IAsyncOperation>[]> successCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation<TResult> | op | An operation to be continued. |
| System.Func<System.Func<IAsyncOperation>[]> | successCallback | The callback to be executed when the operation has completed. |
Returns
| Type | Description |
|---|---|
| IAsyncOperation | Returns a continuation operation that completes after both source operation and the callback has completed. |
Type Parameters
| Name | Description |
|---|---|
| TResult |