Fluid container loader providing core container loading functionality for the Fluid Framework
Utility that wraps a collaboration container so work only runs when connectivity is established and recent operations are synchronized.
runWhenSynchronized rejects without invoking the operation. @teststate reflects whether the container is currently connected, lastSyncSuccessful updates after each catch-up attempt, and calling dispose stops listening to container events and rejects new work. @test@generates
export type ConnectionStatus = "connected" | "disconnected";
export interface SyncableContainer {
connected: boolean;
on(event: "connected" | "disconnected" | "closed", listener: () => void): void;
off?(event: "connected" | "disconnected" | "closed", listener: () => void): void;
}
export type CatchUp = () => Promise<boolean>;
export class ConnectionSyncGuard {
constructor(container: SyncableContainer, waitForCatchUp: CatchUp, options?: {
reconnectTimeoutMs?: number;
});
/** Current connection status derived from the container */
readonly state: ConnectionStatus;
/** Last outcome from a synchronization attempt, undefined before any attempt */
readonly lastSyncSuccessful: boolean | undefined;
/** Enqueue work to run after the container is connected and synchronized */
runWhenSynchronized<T>(work: () => Promise<T>): Promise<T>;
/** Stop listening to container events and reject new work */
dispose(): void;
}Provides the collaboration container primitives, connection events, and synchronization helper needed by the guard.
tessl i tessl/npm-fluidframework--container-loader@2.60.0evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10