waitFor
interface AdbServerConnectionOptions {
unref?: boolean | undefined;
signal?: AbortSignal | undefined;
}
declare class AdbServerClient {
waitFor(
device: AdbServerClient.DeviceSelector,
state: "device" | "disconnect",
options?: AdbServerConnectionOptions
): Promise<void>;
}
Wait for a device to be connected or disconnected. This method returns a Promise that resolves when the condition is met.
If the selector is usb, tcp or undefined, it won't tell which device is connected or disconnected.
Options
unref: If the underlying connection is using Node.jsnetmodule, thenunrefthe socket, so the process can exit even if the connection is still alive.signal: Stops the wait when the signal is aborted.
Equivalent ADB Command
adb wait-for[-TRANSPORT]-STATE
For example:
adb wait-for-device
adb wait-for-usb-device
adb wait-for-disconnect
adb wait-for-usb-disconnect