Skip to content

Commit 2761adc

Browse files
author
Dimitar Tachev
authored
Merge pull request #4488 from NativeScript/tachev/merge-release-into-master
Merge release into master
2 parents 266c63f + 4647935 commit 2761adc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+649
-20179
lines changed

PublicAPI.md

+57
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ const tns = require("nativescript");
5858
* [devicesService](#devicesservice)
5959
* [getEmulatorImages](#getemulatorimages)
6060
* [startEmulator](#startemulator)
61+
* [startDeviceDetectionInterval](#startdevicedetectioninterval)
62+
* [stopDeviceDetectionInterval](#stopdevicedetectioninterval)
63+
* [startEmulatorDetectionInterval](#startemulatordetectioninterval)
64+
* [stopEmulatorDetectionInterval](#stopemulatordetectioninterval)
6165
* [deviceEmitter](#deviceemitter)
6266
* [events](#deviceemitterevents)
6367
* [previewDevicesService](#previewdevicesservice)
@@ -1287,6 +1291,59 @@ tns.devicesService.startEmulator({imageIdentifier: "my emulator imageIdentifier"
12871291
.then(errors => { });
12881292
```
12891293
1294+
### startDeviceDetectionInterval
1295+
Starts device detection interval, which is run on specified number of seconds. This allows detection of new attached devices, started emulators/simulators, detection when device/emulator/simulator is disconnected, etc.
1296+
> NOTE: The interval is started automatically when you call `devicesService.initialize` without passing `skipDeviceDetectionInterval: true`.
1297+
1298+
> NOTE: iOS Device detection interval cannot be stopped, so once started, it will always report connected/disconnected devices.
1299+
1300+
* Definition
1301+
```TypeScript
1302+
startDeviceDetectionInterval({ detectionInterval?: number, platform?: string }): void
1303+
```
1304+
1305+
* Usage
1306+
```JavaScript
1307+
tns.devicesService.startDeviceDetectionInterval({ detectionInterval: 1000 });
1308+
```
1309+
1310+
### stopDeviceDetectionInterval
1311+
Stops device detection interval started by `devicesService.initialize` or `devicesService.startDeviceDetectionInterval`.
1312+
* Definition
1313+
```TypeScript
1314+
stopDeviceDetectionInterval(): void
1315+
```
1316+
1317+
* Usage
1318+
```JavaScript
1319+
tns.devicesService.stopDeviceDetectionInterval();
1320+
```
1321+
1322+
### startEmulatorDetectionInterval
1323+
Starts emulator images detection interval, which is run on specified number of seconds. This allows detection of new installed emulator/simulator images.
1324+
1325+
* Definition
1326+
```TypeScript
1327+
startEmulatorDetectionInterval({ detectionInterval?: number }): void
1328+
```
1329+
1330+
* Usage
1331+
```JavaScript
1332+
tns.devicesService.startEmulatorDetectionInterval({ detectionInterval: 1000 });
1333+
```
1334+
1335+
### stopEmulatorDetectionInterval
1336+
Stops device detection interval started by `devicesService.startEmulatorDetectionInterval`.
1337+
* Definition
1338+
```TypeScript
1339+
stopEmulatorDetectionInterval(): void
1340+
```
1341+
1342+
* Usage
1343+
```JavaScript
1344+
tns.devicesService.stopEmulatorDetectionInterval();
1345+
```
1346+
12901347
## deviceEmitter
12911348
This module is used to emit information for devices, applications on them, etc.
12921349

lib/common/bootstrap.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $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");
910

1011
$injector.require("dispatcher", "./dispatchers");
1112
$injector.require("commandDispatcher", "./dispatchers");

lib/common/child-process.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ChildProcess extends EventEmitter implements IChildProcess {
99

1010
public async exec(command: string, options?: any, execOptions?: IExecOptions): Promise<any> {
1111
return new Promise<any>((resolve, reject) => {
12-
const callback = (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => {
12+
const callback = (error: Error, stdout: string | NodeBuffer, stderr: string | NodeBuffer) => {
1313
this.$logger.trace("Exec %s \n stdout: %s \n stderr: %s", command, stdout.toString(), stderr.toString());
1414

1515
if (error) {
@@ -33,7 +33,7 @@ export class ChildProcess extends EventEmitter implements IChildProcess {
3333
this.$logger.debug("execFile: %s %s", command, this.getArgumentsAsQuotedString(args));
3434

3535
return new Promise<any>((resolve, reject) => {
36-
child_process.execFile(command, args, (error: any, stdout: NodeBuffer) => {
36+
child_process.execFile(command, args, (error: any, stdout: string | NodeBuffer) => {
3737
if (error) {
3838
reject(error);
3939
} else {

lib/common/declarations.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,18 @@ interface ISysInfo {
992992
*/
993993
getJavaCompilerVersion(): Promise<string>;
994994

995+
/**
996+
* Gets JAVA version based on the executable in PATH.
997+
* @return {Promise<string>}
998+
*/
999+
getJavaVersionFromPath(): Promise<string>;
1000+
1001+
/**
1002+
* Gets JAVA version based on the JAVA from JAVA_HOME.
1003+
* @return {Promise<string>}
1004+
*/
1005+
getJavaVersionFromJavaHome(): Promise<string>;
1006+
9951007
/**
9961008
* Gets all global warnings for the current environment, for example Node.js version compatibility, OS compatibility, etc.
9971009
* @return {Promise<ISystemWarning[]>} All warnings. Empty array is returned in case the system is setup correctly.

lib/common/definitions/cli-global.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
declare var _: _.LoDashStatic;
12
/**
23
* Defines additional properties added to global object from CLI.
34
*/
45
interface ICliGlobal extends NodeJS.Global {
56
/**
67
* Lodash instance.
78
*/
8-
_: any;
9+
_: _.LoDashStatic;
910

1011
/**
1112
* Global instance of the module used for dependency injection.

0 commit comments

Comments
 (0)