Skip to content

Commit b106265

Browse files
Merge pull request #109 from telerik/vladimirov/fix-interval
fix: Do not wait 15 seconds to detect simulator
2 parents 56e3abb + 55329a2 commit b106265

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/ios-sim.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Object.defineProperty(publicApi, "getRunningSimulators", {
5555
return new Promise<any>((resolve, reject) => {
5656
const libraryPath = require("./iphone-simulator-xcode-simctl");
5757
const simulator = new libraryPath.XCodeSimctlSimulator();
58-
58+
5959
const tryGetBootedDevices = () => {
6060
try {
6161
return simulator.getBootedDevices.apply(simulator, args);
@@ -75,15 +75,13 @@ Object.defineProperty(publicApi, "getRunningSimulators", {
7575
}
7676

7777
if (!isResolved && (!result || !result.length)) {
78-
let repeatCount = 30;
79-
const timer = setInterval(() => {
78+
const timer = setTimeout(() => {
8079
result = tryGetBootedDevices();
81-
if (((result && result.length) || !repeatCount) && !isResolved) {
80+
81+
if (!isResolved) {
8282
isResolved = true;
83-
clearInterval(timer);
8483
resolve(result);
8584
}
86-
repeatCount--;
8785
}, 500);
8886
}
8987
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ios-sim-portable",
3-
"version": "3.4.3",
3+
"version": "3.4.4",
44
"description": "",
55
"main": "./lib/ios-sim.js",
66
"scripts": {

0 commit comments

Comments
 (0)