Add capability to pass in an Array of Data to the Node

Do the same code for each Element of the array
This commit is contained in:
andreas-froelich 2017-06-19 12:51:06 +01:00
parent e71332dc15
commit 8f097d6cc5

View File

@ -151,9 +151,19 @@ ws.on('error', function() {
});
ws.on('worldmapdata', function(data) {
if (Array.isArray(data)) {
console.log("Data passed in is Array");
for (var prop in data) {
if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
if (data[prop].hasOwnProperty("name")) { setMarker(data[prop]); }
else { console.log("SKIP",data[prop]); }
}
}
else {
if (data.command) { doCommand(data.command); delete data.command; }
if (data.hasOwnProperty("name")) { setMarker(data); }
else { console.log("SKIP",data); }
}
});
if ( window.localStorage.hasOwnProperty("lastpos") ) {