1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

add delay to eddystone scanner startup

This commit is contained in:
Dave Conway-Jones 2016-03-08 20:13:30 +00:00
parent 471840b868
commit 7b72ecd99c
2 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-physical-web",
"version": "0.0.8",
"version": "0.0.10",
"description": "Node-RED nodes to interact with the Physical Web",
"main": "physical-web.js",
"scripts": {

View File

@ -43,7 +43,7 @@ module.exports = function(RED) {
node.error('Error setting beacon URL', e);
}
}
else {node.warn('Beacon node already in use');}
else {node.warn('Beacon already in use');}
}
node.on('input', function(msg) {
@ -90,6 +90,17 @@ module.exports = function(RED) {
EddystoneBeaconScanner.removeListener('updated', onFound);
done();
});
var tout = setTimeout(function() {
EddystoneBeaconScanner.startScanning(true);
},2000);
node.on("close", function(done) {
if (tout) { clearTimeout(tout); }
EddystoneBeaconScanner.stopScanning();
done();
});
}
RED.nodes.registerType("PhysicalWeb in", Scanner);
};