You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use const keyword for immutable variables, Thanks [@dnicolson](https://github.com/dnicolson/). [#184](https://github.com/OpenWonderLabs/node-switchbot/pull/184)
9
+
- Use Error object for promise rejection, Thanks [@dnicolson](https://github.com/dnicolson/). [#181](https://github.com/OpenWonderLabs/node-switchbot/pull/181)
- Use Error object for promise rejection, Thanks [@dnicolson](https://github.com/dnicolson/). [#181](https://github.com/OpenWonderLabs/node-switchbot/pull/181)
19
+
- Use Error object for promise rejection, Thanks [@dnicolson](https://github.com/dnicolson/). [#181](https://github.com/OpenWonderLabs/node-switchbot/pull/181)
// The `SwitchbotDeviceWoHand` object representing the found Bot.
227
-
let device = bot_list[0];
227
+
constdevice= bot_list[0];
228
228
// Put the Bot's arm down (stretch the arm)
229
229
awaitdevice.down();
230
230
// Wait for 5 seconds
@@ -246,13 +246,13 @@ In this code, you can get a [`SwitchbotDeviceWoHand`](#SwitchbotDeviceWoHand-obj
246
246
In order to use the node-switchbot, you have to load the node-switchbot module as follows:
247
247
248
248
```JavaScript
249
-
let Switchbot =require('node-switchbot');
249
+
constSwitchbot=require('node-switchbot');
250
250
```
251
251
252
252
You can get an `Switchbot` constructor from the code above. Then you have to create an `Switchbot` object from the `Switchbot` constructor as follows:
253
253
254
254
```javascript
255
-
let switchbot =newSwitchbot();
255
+
constswitchbot=newSwitchbot();
256
256
```
257
257
258
258
The `Switchbot` constructor takes an argument optionally. It must be a hash object containing the properties as follows:
@@ -263,15 +263,15 @@ The `Switchbot` constructor takes an argument optionally. It must be a hash obje
263
263
264
264
The node-switchbot module uses the [`@abandonware/noble`](https://github.com/abandonware/noble) module in order to interact with BLE devices. If you want to interact other BLE devices using the `@abandonware/noble` module, you can create an `Noble` object by yourself, then pass it to this module. If you don't specify a `Noble` object to the `noble` property, this module automatically create a `Noble` object internally.
265
265
266
-
The sample code below shows how to pass a `Nobel` object to the `Switchbot` constructor.
266
+
The sample code below shows how to pass a `Noble` object to the `Switchbot` constructor.
267
267
268
268
```JavaScript
269
269
// Create a Noble object
270
-
let noble =require('@abandonware/noble');
270
+
constnoble=require('@abandonware/noble');
271
271
272
272
// Create a Switchbot object
273
-
let Switchbot =require('node-switchbot');
274
-
let switchbot =newSwitchbot({'noble': noble});
273
+
constSwitchbot=require('node-switchbot');
274
+
constswitchbot=newSwitchbot({'noble': noble});
275
275
```
276
276
277
277
In the code snippet above, the variable `switchbot` is an `Switchbot` object. The `Switchbot` object has a lot of methods as described in sections below.
@@ -565,7 +565,7 @@ The code below calls the [`press()`](#SwitchbotDeviceWoHand-press-method) method
0 commit comments