flightdash: put switch case with local var in a codeblocK

master
Flaparoo 2024-02-11 09:34:13 +08:00
parent 3e234d3720
commit 4ecb55d23c
1 changed files with 13 additions and 11 deletions

View File

@ -60,17 +60,19 @@
loadNearest(fix.lat, fix.lon); loadNearest(fix.lat, fix.lon);
break; break;
case 'createUserWaypoint': case 'createUserWaypoint':
if (!('userWaypoints' in settings)) {
settings.userWaypoints = []; if (!('userWaypoints' in settings))
let newIdx = settings.userWaypoints.length; settings.userWaypoints = [];
settings.userWaypoints[newIdx] = { let newIdx = settings.userWaypoints.length;
'ID': 'USER'+(newIdx + 1), settings.userWaypoints[newIdx] = {
'lat': fix.lat, 'ID': 'USER'+(newIdx + 1),
'lon': fix.lon, 'lat': fix.lat,
}; 'lon': fix.lon,
writeSettings(); };
showUserWaypoints(); writeSettings();
break; showUserWaypoints();
break;
}
case 'destAVWX': case 'destAVWX':
// the free ("hobby") account of AVWX is limited to 10 nearest stations // the free ("hobby") account of AVWX is limited to 10 nearest stations
avwx.request('station/near/'+fix.lat+','+fix.lon, 'n=10&airport=true&reporting=false', data => { avwx.request('station/near/'+fix.lat+','+fix.lon, 'n=10&airport=true&reporting=false', data => {