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;
|
||||
|
||||
function onFound(beacon) {
|
||||
var topic_data;
|
||||
if (node.topic !== "") {
|
||||
topic_data = node.topic;
|
||||
} else {
|
||||
topic_data = 'found';
|
||||
}
|
||||
node.send({topic: topic_data, payload: beacon});
|
||||
node.send({topic: node.topic || 'found', payload: beacon});
|
||||
}
|
||||
|
||||
function onUpdated(beacon) {
|
||||
var topic_data;
|
||||
if (node.topic !== "") {
|
||||
topic_data = node.topic;
|
||||
} else {
|
||||
topic_data = 'updated';
|
||||
}
|
||||
node.send({topic: topic_data, payload: beacon});
|
||||
node.send({topic: node.topic || 'updated', payload: beacon});
|
||||
}
|
||||
|
||||
function onLost(beacon) {
|
||||
var topic_data;
|
||||
if (node.topic !== "") {
|
||||
topic_data = node.topic;
|
||||
} else {
|
||||
topic_data = 'lost';
|
||||
}
|
||||
node.send({topic: topic_data, payload: beacon});
|
||||
node.send({topic: node.topic || 'lost', payload: beacon});
|
||||
}
|
||||
|
||||
EddystoneBeaconScanner.on('found', onFound);
|
||||
|
Loading…
x
Reference in New Issue
Block a user