Skip to content

Commit

Permalink
Merge pull request #32 from gabric098/feature/node12-support
Browse files Browse the repository at this point in the history
feat(app) Compatibility changes for node 12 support
  • Loading branch information
hufftheweevil authored Apr 28, 2021
2 parents fcf9205 + 63a92ef commit c8c204c
Show file tree
Hide file tree
Showing 7 changed files with 1,083 additions and 16 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "plugin:node/recommended",
"parserOptions": {
"ecmaVersion": 2018
}
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.22.1
6 changes: 3 additions & 3 deletions lib/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ function init(RED) {
} catch (e) {
console.error(e)
}
let thingName = msg.payload?.thing
let thingName = msg.payload && msg.payload.thing
switch (msg.topic) {
case 'send-command':
let { command } = msg.payload
getThings()[thingName]?.handleCommand(command)
getThings()[thingName] && getThings()[thingName].handleCommand(command)
break

case 'update-state':
let { packet, replace = false } = msg.payload
getThings()[thingName]?.updateState(packet, replace)
getThings()[thingName] && getThings()[thingName].updateState(packet, replace)
break

case 'delete-thing':
Expand Down
Loading

0 comments on commit c8c204c

Please sign in to comment.