homey-api 3.0.0-rc.8 → 3.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/HomeyAPI/HomeyAPI.js
CHANGED
|
@@ -129,18 +129,22 @@ class HomeyAPI {
|
|
|
129
129
|
* Create a {@link HomeyAPIV3Local} instance for use in the Apps SDK.
|
|
130
130
|
* @param {Object} opts
|
|
131
131
|
* @param {Homey} opts.homey — Homey instance
|
|
132
|
-
* @param {Function} opts.debug — Debug
|
|
132
|
+
* @param {Function|null} opts.debug — Debug function, defaults to `null`
|
|
133
133
|
*/
|
|
134
134
|
static async createAppAPI({
|
|
135
135
|
homey,
|
|
136
|
-
debug =
|
|
136
|
+
debug = null,
|
|
137
137
|
} = {}) {
|
|
138
138
|
if (!homey) {
|
|
139
139
|
throw new Error('Invalid Homey');
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
if (debug === true) {
|
|
143
|
+
debug = (...props) => homey.app.log('[homey-api]', ...props);
|
|
144
|
+
}
|
|
145
|
+
|
|
142
146
|
const props = {
|
|
143
|
-
debug,
|
|
147
|
+
debug: debug ?? function debug() { },
|
|
144
148
|
token: await homey.api.getOwnerApiToken(),
|
|
145
149
|
baseUrl: await homey.api.getLocalUrl(),
|
|
146
150
|
strategy: [],
|