RunWhileConnectedCoordinator Class

Packages > @fluidframework/container-runtime > RunWhileConnectedCoordinator

Helper class to coordinate something that needs to run only while connected. This provides promises that resolve as it starts or stops. Stopping happens when disconnected or if stop() is called.

Signature:

export declare class RunWhileConnectedCoordinator 

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(runtime) Constructs a new instance of the RunWhileConnectedCoordinator class

Methods

List of methods on this class
Method Modifiers Description
stop() Stops running.
waitStart() Starts and waits for a promise which resolves when connected. The promise will also resolve if stopped either externally or by disconnect. The return value indicates whether the start is successful or not.
waitStopped() Returns a promise that resolves once stopped either externally or by disconnect.

Constructors

RunWhileConnectedCoordinator.(constructor)

Constructs a new instance of the RunWhileConnectedCoordinator class

Signature:

constructor(runtime: IConnectableRuntime);

Parameters

List of parameters
Parameter Type Description
runtime IConnectableRuntime

Methods

stop

Stops running.

Signature:

stop(): void;

Returns:

void

waitStart

Starts and waits for a promise which resolves when connected. The promise will also resolve if stopped either externally or by disconnect. The return value indicates whether the start is successful or not.

Signature:

waitStart(): Promise<IStartedResult | INotStartedResult>;

Returns:

Promise<IStartedResult | INotStartedResult>

waitStopped

Returns a promise that resolves once stopped either externally or by disconnect.

Signature:

waitStopped(): Promise<void>;

Returns:

Promise<void>