resend markers for late joiners

This commit is contained in:
Dave Conway-Jones 2022-02-04 11:24:48 +00:00
parent 6b898e6d3f
commit b5553b2acb
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
5 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.27.0 - Reload existing markers for late joiners
- v2.26.1 - Add QTH/Maidenhead option also
- v2.26.0 - Add UTM and MGRS to coordinate display options.
- v2.25.0 - Add bounds command to set overall map bounds.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.27.0 - Reload existing markers for late joiners
- v2.26.1 - Add QTH/Maidenhead option also
- v2.26.0 - Add UTM and MGRS to coordinate display options.
- v2.25.0 - Add bounds command to set overall map bounds.

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.26.1",
"version": "2.27.0",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"@turf/bezier-spline": "~6.5.0",

View File

@ -15,6 +15,7 @@ module.exports = function(RED) {
}
function worldMap(node, n) {
var allPoints = {};
RED.nodes.createNode(node,n);
node.lat = n.lat || "";
node.lon = n.lon || "";
@ -100,6 +101,9 @@ module.exports = function(RED) {
if (node.name) { c.toptitle = node.name; }
//console.log("INIT",c)
client.write(JSON.stringify({command:c}));
var o = Object.values(allPoints);
o.map(v => delete v.tout);
setTimeout(function() { client.write(JSON.stringify(o)) }, 250);
}
});
client.on('close', function() {
@ -121,6 +125,12 @@ module.exports = function(RED) {
}
}
}
if (msg.payload.hasOwnProperty("name")) {
allPoints[msg.payload.name] = msg.payload;
var t = node.maxage || 3600;
if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
allPoints[msg.payload.name].tout = setTimeout( function() { delete allPoints[msg.payload.name] }, t * 1000 );
}
});
node.on("close", function() {
for (var c in clients) {

View File

@ -915,7 +915,6 @@ var addBaseMaps = function(maplist,first) {
}
}
// Now add the overlays
var addOverlays = function(overlist) {
//console.log("OVERLAYS",overlist)