mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	add delay to eddystone scanner startup
This commit is contained in:
		@@ -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": {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user