diff --git a/hardware/physical-web/package.json b/hardware/physical-web/package.json index 67686a26..a206b713 100644 --- a/hardware/physical-web/package.json +++ b/hardware/physical-web/package.json @@ -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": { diff --git a/hardware/physical-web/physical-web.js b/hardware/physical-web/physical-web.js index d0e5f4f0..576bb84e 100644 --- a/hardware/physical-web/physical-web.js +++ b/hardware/physical-web/physical-web.js @@ -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); };