For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/react/Types/MainThreadRef.md.
  • 简体中文
  • Class: MainThreadRef<T>

    MainThreadRef 是一种只能在主线程访问的 ref,用于在主线程函数调用之间保存状态。保存在 MainThreadRef 的 current 属性中的数据,可以在多个主线程函数中读写。

    Type Parameters

    Type Parameter
    T

    Constructors

    Constructor

    new MainThreadRef<T>(initValue: T): MainThreadRef<T>

    Parameters

    ParameterType
    initValueT

    Returns

    MainThreadRef<T>

    Accessors

    current

    Get Signature

    get current(): T

    Returns

    T

    Set Signature

    set current(_: T): void

    Parameters
    ParameterType
    _T
    Returns

    void

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。