Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
Allow topic custom_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
bartbutenaers authored Nov 17, 2021
1 parent e049d5c commit 05da557
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions svg_graphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ div.ui-svg path {
}
}
}
else if(msg.topic == "custom_msg") {
// no checks
}
else {
if (msg.topic && (typeof payload == "string" || typeof payload == "number")) {
var topicParts = msg.topic.split("|");
Expand Down Expand Up @@ -397,14 +400,16 @@ div.ui-svg path {
}
}
else {
if(typeof msg.payload === "object" && !msg.payload.command) {
node.error("The msg.payload should contain an object which has a 'command' property.");
msg.payload = null;
}
// Make sure the commands are not case sensitive anymore
else if(!node.availableCommands.includes(msg.payload.command.toLowerCase())) {
node.error("The msg.payload contains an object that has an unsupported command property '" + msg.payload.command + "'");
msg.payload = null;
if(typeof msg.payload === "object") {
if(!msg.payload.command) {
node.error("The msg.payload should contain an object which has a 'command' property.");
msg.payload = null;
}
// Make sure the commands are not case sensitive anymore
else if(!node.availableCommands.includes(msg.payload.command.toLowerCase())) {
node.error("The msg.payload contains an object that has an unsupported command property '" + msg.payload.command + "'");
msg.payload = null;
}
}
}
}
Expand Down Expand Up @@ -1173,8 +1178,12 @@ div.ui-svg path {
}
});

if(topic){
if(topic == "databind"){
if(topic){
if(topic == "custom_msg") {
// do nothing
return;
}
else if(topic == "databind"){
//Bind entries in "Input Bindings" TAB
var bindings = $scope.config.bindings;
bindings.forEach(function (binding) {
Expand Down Expand Up @@ -1893,7 +1902,10 @@ div.ui-svg path {
return;
}

if(topic == "databind" || ((typeof payload == "string" || typeof payload == "number") && topic)){
if(topic == "custom_msg") {
processCommand(payload, topic);
}
else if(topic == "databind" || ((typeof payload == "string" || typeof payload == "number") && topic)){
processCommand(payload, topic);
} else {
if(!Array.isArray(payload)){
Expand Down

0 comments on commit 05da557

Please sign in to comment.