Skip to content

Commit ac6669f

Browse files
Enjoy, world!
1 parent 618dea7 commit ac6669f

File tree

3 files changed

+11
-12892
lines changed

3 files changed

+11
-12892
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# NativeScript Particle plugin
22

3-
> Control your [Particle.io](https://particle.io) devices from a NativeScript app!
4-
53
[![NPM version][npm-image]][npm-url]
64
[![Downloads][downloads-image]][npm-url]
75
[![Twitter Follow][twitter-image]][twitter-url]
@@ -14,12 +12,12 @@
1412
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
1513
[twitter-url]:https://twitter.com/eddyverbruggen
1614

17-
<img src="demo/app/images/particle-logo.png" width="250px" alt="Particle.io logo"/><br/>
15+
<img src="https://github.com/EddyVerbruggen/nativescript-particle/raw/master/demo/app/images/particle-logo.png" width="250px" alt="Particle.io logo"/><br/>
1816

1917
## Prerequisites
2018
Hop on over to [the Particle.io store](https://store.particle.io) and order any of their cool devices.
2119

22-
While developing this plugin and the [demo app](demo/) I used a [Photon Kit](https://store.particle.io/collections/photon) and it was a joy to work with (thanks, [Brandon Satrom](https://twitter.com/BrandonSatrom) for sending one over!).
20+
> While developing this plugin and the [demo app](demo/) I used a [Photon Kit](https://store.particle.io/collections/photon) and it was a joy to work with (thanks, [Brandon Satrom](https://twitter.com/BrandonSatrom) for sending one over)!
2321
2422
## Installation
2523
```bash
@@ -34,10 +32,10 @@ follow these steps to install the demo app I've created with NativeScript Core:
3432
git clone https://github.com/EddyVerbruggen/nativescript-particle
3533
cd nativescript-particle/src
3634
npm i
37-
npm run demo.ios # or demo.android
35+
npm run demo.ios # or demo.android
3836
```
3937

40-
> Tip: If you get fed up by entering your login credentials every time, set the `PARTICLE_USERNAME` and `PARTICLE_PASSWORD` properties to reflect your own, at `demo/app/main-view-modal.ts`.
38+
> Tip: If you get tired entering your login credentials every time you log in, set the [`PARTICLE_USERNAME` and `PARTICLE_PASSWORD` properties to reflect your own](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/demo/app/main-view-model.ts#L7-L8).
4139
4240
## API
4341
All examples below assume you have these imports and instantiated the `Particle` class:
@@ -48,7 +46,8 @@ const particle = new Particle();
4846
```
4947

5048
### `login`
51-
Communication between your app and a device is HTTP (REST) based, so the first step is authenticating yourself with the Particle Cloud.
49+
Communication between your app and a device is HTTP (REST) based,
50+
so the first step is authenticating yourself with the Particle Cloud:
5251

5352
```typescript
5453
particle.login(
@@ -91,14 +90,15 @@ The returned list of `TNSParticleDevice` objects has these properties and functi
9190
| id | `string` | The unique ID of this device. |
9291
| name | `string` | The given name of this device. |
9392
| status | `string` | The current status of the device, usually `normal`. |
94-
| type | `TNSParticleDeviceType` | One of `Unknown`, `Core`, `Photon`, `P1`, `Electron`, `RaspberryPi`, `DigistumpOak`, `RedBearDuo`, `Bluz`. |
93+
| type | `[TNSParticleDeviceType](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/src/particle.common.ts#L1-L10)` | One of `Unknown`, `Core`, `Photon`, `P1`, `Electron`, `RaspberryPi`, `DigistumpOak`, `RedBearDuo`, `Bluz`. |
9594
| functions | `Array<string>` | The list of functions currently available on the device. You can invoke these with `callFunction` (see below). |
96-
| variables | `Array<TNSParticleDeviceVariable>` | The list of variables currently available on the device. You can get their values with `getVariable` (see below). |
95+
| variables | Array<[TNSParticleDeviceVariable](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/src/particle.common.ts#L38-L41)> | The list of variables currently available on the device. You can get their values with `getVariable` (see below). |
9796

9897
#### `<device>.callFunction`
9998
You can invoke any of the `functions` you discovered on the device.
10099

101-
As an example let's assume you've flashed [this code tutorial](https://docs.particle.io/guide/getting-started/examples/photon/#read-your-photoresistor-function-and-variable) to your device, so there's a `led` function which takes 1 argument: `"on"`, or `"off"`:
100+
As an example let's assume you've flashed [this code tutorial](https://docs.particle.io/guide/getting-started/examples/photon/#read-your-photoresistor-function-and-variable) to your device,
101+
so there's a `led` function which takes 1 argument: the value must be either `"on"`, or `"off"`:
102102

103103
```typescript
104104
const myDevice: TNSParticleDevice = null; // you got this from 'listDevices'

0 commit comments

Comments
 (0)