Skip to content
On this page

AsyncHandler<T> (Class)

Helper class for success/error callback handling.

Type Parameters

FieldDescription
TThe type of object expected in the successful callback.

Fields

FieldDescription
System.Action<T> onSuccessCallback function to call upon success.
System.Action<string> onErrorCallback function to call upon error.

Methods

AsyncHandler (Constructor)

ParameterDescription
System.Action<T> onSuccessCallback function to set.
System.Action<string> onErrorCallback function to set.

Reset

Resets the onSuccess and onError callbacks to null.

Resolve

Invokes the onSuccess callback with the given result and resets the handlers.

ParameterDescription
T resultThe result to pass to the onSuccess callback.

Reject

Invokes the onError callback with the given error and resets the handlers.

ParameterDescription
string errorThe error message to pass to the onError callback.