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.
@@ -279,7 +279,7 @@
279
279
 
280
280
 
281
281
 
282
- debug: function,
282
+ debug: function | null,
283
283
 
284
284
 
285
285
  },
@@ -5371,7 +5371,7 @@
5371
5371
 
5372
5372
 
5373
5373
 
5374
- debug: function,
5374
+ debug: function | null,
5375
5375
 
5376
5376
 
5377
5377
  },
@@ -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 method, defaults to `homey.app.log`
132
+ * @param {Function|null} opts.debug — Debug function, defaults to `null`
133
133
  */
134
134
  static async createAppAPI({
135
135
  homey,
136
- debug = (...props) => homey.app.log('[homey-api]', ...props),
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: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.0.0-rc.8",
3
+ "version": "3.0.0-rc.9",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [