Skip to content

Commit b97f5aa

Browse files
chore: remove $timers
Remove previously introduced `$timers` - the idea was to use $timers as we wanted to kill remaining timers when SIGINT is sent to CLI. As CLI no longer handles SIGINT signal, Node.js kills the timers on its own, so there's no need of additional timers implementation.
1 parent 0ce13f5 commit b97f5aa

File tree

6 files changed

+5
-28
lines changed

6 files changed

+5
-28
lines changed

lib/common/bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ $injector.require("errors", "./errors");
66
$injector.requirePublic("fs", "./file-system");
77
$injector.require("hostInfo", "./host-info");
88
$injector.require("osInfo", "./os-info");
9-
$injector.require("timers", "./timers");
109

1110
$injector.require("dispatcher", "./dispatchers");
1211
$injector.require("commandDispatcher", "./dispatchers");

lib/common/definitions/timers.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/common/mobile/mobile-core/devices-service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
4242
private $androidEmulatorServices: Mobile.IEmulatorPlatformService,
4343
private $androidEmulatorDiscovery: Mobile.IDeviceDiscovery,
4444
private $emulatorHelper: Mobile.IEmulatorHelper,
45-
private $prompter: IPrompter,
46-
private $timers: ITimers) {
45+
private $prompter: IPrompter) {
4746
super();
4847
this.attachToKnownDeviceDiscoveryEvents();
4948
this.attachToKnownEmulatorDiscoveryEvents();
@@ -293,7 +292,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
293292
if (!this.deviceDetectionInterval) {
294293
let isDeviceDetectionIntervalInProgress = false;
295294

296-
this.deviceDetectionInterval = this.$timers.setInterval(async () => {
295+
this.deviceDetectionInterval = setInterval(async () => {
297296
if (isDeviceDetectionIntervalInProgress) {
298297
return;
299298
}
@@ -320,7 +319,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
320319
@exported("devicesService")
321320
public startEmulatorDetectionInterval(opts: Mobile.IHasDetectionInterval = {}): void {
322321
let isEmulatorDetectionIntervalRunning = false;
323-
this.emulatorDetectionInterval = this.$timers.setInterval(async () => {
322+
this.emulatorDetectionInterval = setInterval(async () => {
324323
if (isEmulatorDetectionIntervalRunning) {
325324
return;
326325
}
@@ -336,14 +335,14 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
336335
@exported("devicesService")
337336
public stopDeviceDetectionInterval(): void {
338337
if (this.deviceDetectionInterval) {
339-
this.$timers.clearInterval(this.deviceDetectionInterval);
338+
clearInterval(this.deviceDetectionInterval);
340339
}
341340
}
342341

343342
@exported("devicesService")
344343
public stopEmulatorDetectionInterval(): void {
345344
if (this.emulatorDetectionInterval) {
346-
this.$timers.clearInterval(this.emulatorDetectionInterval);
345+
clearInterval(this.emulatorDetectionInterval);
347346
}
348347
}
349348

lib/common/test/unit-tests/mobile/devices-service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { CommonLoggerStub, ErrorsStub } from "../stubs";
1414
import { Messages } from "../../../messages/messages";
1515
import * as constants from "../../../constants";
1616
import { DevicePlatformsConstants } from "../../../mobile/device-platforms-constants";
17-
import { Timers } from "../../../timers";
1817

1918
const helpers = require("../../../helpers");
2019
const originalIsInteractive = helpers.isInteractive;
@@ -183,7 +182,6 @@ function createTestInjector(): IInjector {
183182
testInjector.register("androidProcessService", { /* no implementation required */ });
184183
testInjector.register("androidEmulatorDiscovery", AndroidEmulatorDiscoveryStub);
185184
testInjector.register("emulatorHelper", {});
186-
testInjector.register("timers", Timers);
187185

188186
return testInjector;
189187
}

lib/common/timers.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/ios-project-service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ function createTestInjector(projectPath: string, projectName: string, xCode?: IX
159159
removeExtensions: () => { /* */ },
160160
addExtensionsFromPath: () => Promise.resolve()
161161
});
162-
testInjector.register("timers", {});
163162
return testInjector;
164163
}
165164

0 commit comments

Comments
 (0)