import { AgoraRteError } from './error'; export declare enum JoinManagerState { IDLE = "idle", JOINING = "joining", JOINED = "joined", FAILED = "failed" } export interface JoinManagerOptions { onSuccess?: (result: T) => void; onFailure?: (error: AgoraRteError) => void; } /** * JoinManager provides reentrancy protection and state management for join operations. * 为 join 操作提供重入保护和状态管理。 */ export declare class JoinManager { private _state; private _currentPromise; private _result; private _error; private _options; constructor(options?: JoinManagerOptions); static create(options?: JoinManagerOptions): JoinManager; get state(): JoinManagerState; get isJoined(): boolean; get isJoining(): boolean; get isIdle(): boolean; get isFailed(): boolean; /** * Execute the join operation with reentrancy protection * @param joinFn The join function to execute * @returns Promise that resolves to the result */ execute(joinFn: () => Promise): Promise; /** * Create a managed wrapper around a join function. * Each invocation goes through the same reentrancy/caching logic as execute. */ manage Promise>(fn: F): (...args: Parameters) => Promise; /** * Reset the manager state to allow new join operations */ reset(): void; /** * Get the last error if join failed */ getLastError(): AgoraRteError | null; /** * Get the last successful result */ getLastResult(): T | null; private _reset; private _invokeCallbackSafe; }