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:
parent
471840b868
commit
7b72ecd99c
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-physical-web",
|
"name": "node-red-node-physical-web",
|
||||||
"version": "0.0.8",
|
"version": "0.0.10",
|
||||||
"description": "Node-RED nodes to interact with the Physical Web",
|
"description": "Node-RED nodes to interact with the Physical Web",
|
||||||
"main": "physical-web.js",
|
"main": "physical-web.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -43,7 +43,7 @@ module.exports = function(RED) {
|
|||||||
node.error('Error setting beacon URL', e);
|
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) {
|
node.on('input', function(msg) {
|
||||||
@ -90,6 +90,17 @@ module.exports = function(RED) {
|
|||||||
EddystoneBeaconScanner.removeListener('updated', onFound);
|
EddystoneBeaconScanner.removeListener('updated', onFound);
|
||||||
done();
|
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);
|
RED.nodes.registerType("PhysicalWeb in", Scanner);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user