@mcesystems/adb-kit 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -31013,10 +31013,11 @@ var AdbDeviceKit = class {
|
|
|
31013
31013
|
const devices = await this.listDevices();
|
|
31014
31014
|
return !!devices.find((device) => device.id === this.deviceId);
|
|
31015
31015
|
}
|
|
31016
|
-
async waitForUsbDebugging(timeout2 = 12e4) {
|
|
31016
|
+
async waitForUsbDebugging(timeout2 = 12e4, numberOfAllowedAttempts = 5) {
|
|
31017
31017
|
if (await this.hasUsbDebugging()) {
|
|
31018
31018
|
return true;
|
|
31019
31019
|
}
|
|
31020
|
+
let count = numberOfAllowedAttempts;
|
|
31020
31021
|
const tracker = await this.client.trackDevices();
|
|
31021
31022
|
return new Promise((resolve, reject) => {
|
|
31022
31023
|
const timeoutId = setTimeout(() => {
|
|
@@ -31032,10 +31033,12 @@ var AdbDeviceKit = class {
|
|
|
31032
31033
|
}
|
|
31033
31034
|
});
|
|
31034
31035
|
tracker.on("change", (device) => {
|
|
31035
|
-
|
|
31036
|
+
count--;
|
|
31037
|
+
if (device.type === "device" && count > 0) {
|
|
31036
31038
|
clearTimeout(timeoutId);
|
|
31037
31039
|
resolve(true);
|
|
31038
|
-
} else {
|
|
31040
|
+
} else if (count === 0) {
|
|
31041
|
+
this.client.kill();
|
|
31039
31042
|
resolve(false);
|
|
31040
31043
|
}
|
|
31041
31044
|
});
|