跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com

状态管理

最后更新 查看 MarkdownAgent 设置

前提条件

本页面基于 基本实现指南。请确保您已先阅读该指南。

本页面上的代码示例假设您已导入必要的包并初始化了 SDK。

UI Kit 组件如何通信

以下是打开参与者侧边栏时状态同步如何工作的示例:

flowchart LR
    accTitle: Sidebar State Synchronization Example
    accDescr: Example showing how clicking participants toggle updates sidebar through meeting coordination

    Toggle["👤 ParticipantsToggle<br/>(User clicks)"]
    Meeting["Meeting Component<br/>(State Coordinator)"]
    Sidebar["Sidebar<br/>(Opens/Closes)"]
    App["Your App<br/>(Gets notified)"]

    Toggle -->|"emits rtkStateUpdate<br/>{activeSidebar: true,<br/>sidebar: 'participants'}"|Meeting
    Meeting -->|"propagates state"|Sidebar
    Meeting -->|"emits rtkStatesUpdate"|App

    style Meeting fill:#F48120,stroke:#333,stroke-width:2px,color:#fff
    style App fill:#0051C3,stroke:#333,stroke-width:2px,color:#fff

状态流

监听状态更新

要根据会议状态的更改构建自定义 UI 或执行操作,您需要观察来自 UI Kit 的状态更新。

示例代码

状态属性

最佳实践

这篇文档对您有帮助吗?