docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ThunkAPI<TArg, TPayload>

    An interface to interact with the thunk during the execution. You can use this interface to abort the thunk, reject the thunk with a value, or fulfill the thunk with a value. You also have access to the store to dispatch new actions.

    Inheritance
    object
    ThunkAPI<TArg, TPayload>
    Implements
    IThunkAPI<TArg, TPayload>
    IThunkAPI<TPayload>
    IAPIInterceptor<TPayload>
    IThunkAPI
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.Redux
    Assembly: Unity.AppUI.Redux.dll
    Syntax
    public class ThunkAPI<TArg, TPayload> : IThunkAPI<TArg, TPayload>, IThunkAPI<TPayload>, IAPIInterceptor<TPayload>, IThunkAPI
    Type Parameters
    Name Description
    TArg

    The type of the argument to pass to the thunk.

    TPayload

    The type of the payload.

    Properties

    arg

    The argument passed to the thunk when it was dispatched.

    Declaration
    public TArg arg { get; }
    Property Value
    Type Description
    TArg

    cancellationToken

    The cancellation token of the thunk.

    Declaration
    public CancellationToken cancellationToken { get; }
    Property Value
    Type Description
    CancellationToken

    isCancellationRequested

    Whether the thunk has been canceled (ether by the API or by an external cancellation token).

    Declaration
    public bool isCancellationRequested { get; }
    Property Value
    Type Description
    bool

    requestId

    The request ID of the thunk.

    Declaration
    public string requestId { get; }
    Property Value
    Type Description
    string

    store

    The store to dispatch new actions or access the state.

    Declaration
    public IDispatchable store { get; }
    Property Value
    Type Description
    IDispatchable

    Methods

    Abort(object)

    Aborts the thunk.

    Declaration
    public void Abort(object reason)
    Parameters
    Type Name Description
    object reason

    The reason for aborting the thunk. It can be null.

    FulFillWithValue(TPayload)

    Fulfills the thunk with a value.

    Declaration
    public void FulFillWithValue(TPayload value)
    Parameters
    Type Name Description
    TPayload value

    The value to fulfill the thunk with.

    RejectWithValue(TPayload)

    Rejects the thunk with a value.

    Declaration
    public void RejectWithValue(TPayload value)
    Parameters
    Type Name Description
    TPayload value

    The value to reject the thunk with.

    Implements

    IThunkAPI<TArg, TPayload>
    IThunkAPI<TPayload>
    IAPIInterceptor<TPayload>
    IThunkAPI

    Extension Methods

    AsyncThunkAPIExtensions.Dispatch(IThunkAPI, string)
    AsyncThunkAPIExtensions.Dispatch(IThunkAPI, ActionCreator)
    AsyncThunkAPIExtensions.Dispatch(IThunkAPI, IAction)
    AsyncThunkAPIExtensions.Dispatch<TPayload>(IThunkAPI, string, TPayload)
    AsyncThunkAPIExtensions.Dispatch<TPayload>(IThunkAPI, ActionCreator<TPayload>, TPayload)
    AsyncThunkAPIExtensions.GetState<TState>(IThunkAPI)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)