docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SubscriptionBase<TStore, TState, TSelected>

    A base subscription to a store for a selected state.

    Inheritance
    object
    SubscriptionBase<TStore, TState, TSelected>
    Subscription<TState, TSelected>
    Implements
    ISubscription<TState>
    IDisposableSubscription
    IDisposable
    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 abstract class SubscriptionBase<TStore, TState, TSelected> : ISubscription<TState>, IDisposableSubscription, IDisposable where TStore : class, IStore
    Type Parameters
    Name Description
    TStore

    The type of the store.

    TState

    The type of the store state.

    TSelected

    The type of the selected state.

    Constructors

    SubscriptionBase(Selector<TState, TSelected>, Listener<TSelected>, TStore, SubscribeOptions<TSelected>)

    Create a new subscription to a store for a selected state.

    Declaration
    protected SubscriptionBase(Selector<TState, TSelected> selector, Listener<TSelected> listener, TStore store, SubscribeOptions<TSelected> options)
    Parameters
    Type Name Description
    Selector<TState, TSelected> selector

    The selector to use to select the state.

    Listener<TSelected> listener

    The listener to notify of state changes.

    TStore store

    The store to subscribe to.

    SubscribeOptions<TSelected> options

    The options for the subscription.

    Methods

    Dispose()

    Declaration
    public void Dispose()

    GetStoreState(TStore)

    Get the state from the store.

    Declaration
    protected abstract TState GetStoreState(TStore store)
    Parameters
    Type Name Description
    TStore store

    The store to get the state from.

    Returns
    Type Description
    TState

    The state from the store.

    IsValid()

    Whether the subscription is still valid. A Subscription is no longer valid when it has been unsubscribed or of the store it was subscribed to has been disposed.

    Declaration
    public bool IsValid()
    Returns
    Type Description
    bool

    True if the subscription is still valid, false otherwise.

    Notify(TState)

    Notify the listener of a new state.

    Declaration
    public void Notify(TState state)
    Parameters
    Type Name Description
    TState state

    The new state of the store.

    RemoveFromStore(TStore)

    Remove the subscription from the store.

    Declaration
    protected abstract bool RemoveFromStore(TStore store)
    Parameters
    Type Name Description
    TStore store

    The store to remove the subscription from.

    Returns
    Type Description
    bool

    Whether the subscription was removed.

    Unsubscribe()

    Unsubscribe from the store.

    Declaration
    public bool Unsubscribe()
    Returns
    Type Description
    bool

    True if the subscription was removed, false otherwise.

    Implements

    ISubscription<TState>
    IDisposableSubscription
    IDisposable
    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)