Skip to content

Commit f0d2f8a

Browse files
committed
docs: add docs for deviceFound, deviceLost and deviceLogData events in PublicAPI.md
1 parent 123206b commit f0d2f8a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

PublicAPI.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const tns = require("nativescript");
3636
* [debug](#debug)
3737
* [liveSyncService](#livesyncservice)
3838
* [liveSync](#livesync)
39+
* [liveSyncToPreviewApp](#livesynctopreviewapp)
3940
* [stopLiveSync](#stopLiveSync)
4041
* [enableDebugging](#enableDebugging)
4142
* [attachDebugger](#attachDebugger)
@@ -58,6 +59,12 @@ const tns = require("nativescript");
5859
* [startEmulator](#startemulator)
5960
* [deviceEmitter](#deviceemitter)
6061
* [events](#deviceemitterevents)
62+
* [previewDevicesService](#previewdevicesservice)
63+
* [deviceFound](#devicefound)
64+
* [deviceLost](#devicelost)
65+
* [deviceLog](#devicelog)
66+
* [previewQrCodeService](#previewqrcodeservice)
67+
* [getPlaygroundAppQrCode](#getplaygroundappqrCode)
6168

6269
## Module projectService
6370

@@ -1341,6 +1348,35 @@ tns.deviceEmitter.on("emulatorImageLost", (emulatorImageInfo) => {
13411348
```
13421349
`emulatorImageInfo` is of type [Moble.IDeviceInfo](https://github.com/telerik/mobile-cli-lib/blob/61cdaaaf7533394afbbe84dd4eee355072ade2de/definitions/mobile.d.ts#L9-L86).
13431350
1351+
## previewDevicesService
1352+
The `previewDevicesService` module allows interaction with preview devices. You can get a list of the connected preview devices and logs from specified device.
1353+
1354+
### previewDevicesEmitterEvents
1355+
1356+
* `deviceFound` - Raised when the QR code is scanned with any device. The callback function will receive one argument - `device`.
1357+
Sample usage:
1358+
```JavaScript
1359+
tns.previewDevicesService.on("deviceFound", device => {
1360+
console.log("Attached device with identifier: " + device.id);
1361+
});
1362+
```
1363+
1364+
* `deviceLost` - Raised when the Preview app is stopped on a specified device. The callback function will receive one argument - `device`.
1365+
Sample usage:
1366+
```JavaScript
1367+
tns.previewDevicesService.on("deviceLost", device => {
1368+
console.log("Detached device with identifier: " + device.id);
1369+
});
1370+
```
1371+
1372+
* `deviceLog` - Raised when the app deployed in Preview app reports any information. The event is raised for any device that reports data. The callback function has two arguments - `device` and `message`. <br/><br/>
1373+
Sample usage:
1374+
```JavaScript
1375+
tns.previewDevicesService.on("deviceLogData", (device, message) => {
1376+
console.log("Device " + device.id + " reports: " + message);
1377+
});
1378+
```
1379+
13441380
## How to add a new method to Public API
13451381
CLI is designed as command line tool and when it is used as a library, it does not give you access to all of the methods. This is mainly implementation detail. Most of the CLI's code is created to work in command line, not as a library, so before adding method to public API, most probably it will require some modification.
13461382
For example the `$options` injected module contains information about all `--` options passed on the terminal. When the CLI is used as a library, the options are not populated. Before adding method to public API, make sure its implementation does not rely on `$options`.

0 commit comments

Comments
 (0)