Comparing version 6.0.1 to 6.1.0
12
index.js
@@ -33,2 +33,4 @@ // Import packages | ||
* containing a payload of null values for on-device JSON parsing errors | ||
* @param {Boolean} [options.issueGetOnConnect=true] if true, sends GET request after | ||
* connection is established. This should probably be `false` in synchronous usage. | ||
* @example | ||
@@ -47,3 +49,4 @@ * const tuya = new TuyaDevice({id: 'xxxxxxxxxxxxxxxxxxxx', | ||
version = 3.1, | ||
nullPayloadOnJSONError = false | ||
nullPayloadOnJSONError = false, | ||
issueGetOnConnect = true | ||
} = {}) { | ||
@@ -53,2 +56,5 @@ super(); | ||
this.device = {ip, port, id, gwID, key, productKey, version}; | ||
this.globalOptions = { | ||
issueGetOnConnect | ||
}; | ||
@@ -443,3 +449,5 @@ this.nullPayloadOnJSONError = nullPayloadOnJSONError; | ||
// can emit a `data` event as soon as possible | ||
this.get(); | ||
if (this.globalOptions.issueGetOnConnect) { | ||
this.get(); | ||
} | ||
@@ -446,0 +454,0 @@ // Return |
{ | ||
"name": "tuyapi", | ||
"version": "6.0.1", | ||
"version": "6.1.0", | ||
"description": "An easy-to-use API for devices that use Tuya's cloud services", | ||
@@ -41,5 +41,5 @@ "main": "index.js", | ||
"debug": "4.1.1", | ||
"p-queue": "6.6.1", | ||
"p-retry": "4.2.0", | ||
"p-timeout": "3.2.0", | ||
"p-queue": "6.6.1" | ||
"p-timeout": "3.2.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "devDependencies": { | ||
"delay": "4.3.0", | ||
"documentation": "12.1.4", | ||
"documentation": "^12.1.4", | ||
"nyc": "15.0.0", | ||
@@ -55,0 +55,0 @@ "xo": "0.25.4" |
@@ -75,3 +75,4 @@ # TuyAPI 🌧 🔌 | ||
id: 'xxxxxxxxxxxxxxxxxxxx', | ||
key: 'xxxxxxxxxxxxxxxx'}); | ||
key: 'xxxxxxxxxxxxxxxx', | ||
issueGetOnConnect: false}); | ||
@@ -78,0 +79,0 @@ (async () => { |
45136
1038
164