@mcesystems/adb-kit 1.0.37 → 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.js
CHANGED
|
@@ -31021,10 +31021,11 @@ var AdbDeviceKit = class {
|
|
|
31021
31021
|
const devices = await this.listDevices();
|
|
31022
31022
|
return !!devices.find((device) => device.id === this.deviceId);
|
|
31023
31023
|
}
|
|
31024
|
-
async waitForUsbDebugging(timeout2 = 12e4) {
|
|
31024
|
+
async waitForUsbDebugging(timeout2 = 12e4, numberOfAllowedAttempts = 5) {
|
|
31025
31025
|
if (await this.hasUsbDebugging()) {
|
|
31026
31026
|
return true;
|
|
31027
31027
|
}
|
|
31028
|
+
let count = numberOfAllowedAttempts;
|
|
31028
31029
|
const tracker = await this.client.trackDevices();
|
|
31029
31030
|
return new Promise((resolve, reject) => {
|
|
31030
31031
|
const timeoutId = setTimeout(() => {
|
|
@@ -31040,10 +31041,12 @@ var AdbDeviceKit = class {
|
|
|
31040
31041
|
}
|
|
31041
31042
|
});
|
|
31042
31043
|
tracker.on("change", (device) => {
|
|
31043
|
-
|
|
31044
|
+
count--;
|
|
31045
|
+
if (device.type === "device" && count > 0) {
|
|
31044
31046
|
clearTimeout(timeoutId);
|
|
31045
31047
|
resolve(true);
|
|
31046
|
-
} else {
|
|
31048
|
+
} else if (count === 0) {
|
|
31049
|
+
this.client.kill();
|
|
31047
31050
|
resolve(false);
|
|
31048
31051
|
}
|
|
31049
31052
|
});
|