mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Cleaner topic slection
This commit is contained in:
parent
6d32edc0f2
commit
f6365b0c66
@ -187,33 +187,15 @@ module.exports = function(RED) {
|
|||||||
node.duplicates = n.duplicates;
|
node.duplicates = n.duplicates;
|
||||||
|
|
||||||
function onFound(beacon) {
|
function onFound(beacon) {
|
||||||
var topic_data;
|
node.send({topic: node.topic || 'found', payload: beacon});
|
||||||
if (node.topic !== "") {
|
|
||||||
topic_data = node.topic;
|
|
||||||
} else {
|
|
||||||
topic_data = 'found';
|
|
||||||
}
|
|
||||||
node.send({topic: topic_data, payload: beacon});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdated(beacon) {
|
function onUpdated(beacon) {
|
||||||
var topic_data;
|
node.send({topic: node.topic || 'updated', payload: beacon});
|
||||||
if (node.topic !== "") {
|
|
||||||
topic_data = node.topic;
|
|
||||||
} else {
|
|
||||||
topic_data = 'updated';
|
|
||||||
}
|
|
||||||
node.send({topic: topic_data, payload: beacon});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLost(beacon) {
|
function onLost(beacon) {
|
||||||
var topic_data;
|
node.send({topic: node.topic || 'lost', payload: beacon});
|
||||||
if (node.topic !== "") {
|
|
||||||
topic_data = node.topic;
|
|
||||||
} else {
|
|
||||||
topic_data = 'lost';
|
|
||||||
}
|
|
||||||
node.send({topic: topic_data, payload: beacon});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EddystoneBeaconScanner.on('found', onFound);
|
EddystoneBeaconScanner.on('found', onFound);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user