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:
parent
e71332dc15
commit
8f097d6cc5
@ -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") ) {
|
||||
|
Loading…
Reference in New Issue
Block a user