Conversation
UlisesGascon
left a comment
There was a problem hiding this comment.
@codemcu se nota como vas asentando asincronía y te vas alejando de Angular. Muy bien enfocado, pequeños detalles que cambiar... pero en general muuuy bien! 😍
| }); | ||
| } | ||
|
|
||
| init(URL); |
There was a problem hiding this comment.
No es un mal patrón definir una inicialización como init 👍
| const markers = coordinates.map(function (location, i) { | ||
| return new google.maps.Marker({ | ||
| position: location, | ||
| label: labels[i % labels.length] |
There was a problem hiding this comment.
Sería más interesante tirar de información del propio medio de transporte... lat, lon, etc...
| initMap(coordinates); | ||
| } | ||
|
|
||
| function initMap(coordinates) { |
There was a problem hiding this comment.
Bien enfocado! Me gusta que juntes las funcionalidades bajo nombres tan claros! 👍
|
|
||
| function getAllRoutes(vehicles) { | ||
| let vehiclesConcat = []; | ||
| vehiclesConcat = Array.prototype.concat.apply([], vehicles); |
There was a problem hiding this comment.
podrias dejarlo en una linea! y además tirar de array.from()
| return replaced; | ||
| } | ||
|
|
||
| async function getAllVehicles(arrayUrlsParsed) { |
There was a problem hiding this comment.
Dale una vuelta a esta función... por un lado mezclas mucho async/await para luego devolver un promise.All que podrías haber gestionado muy distinto. Pero muy muy buen enfoque.
| } | ||
|
|
||
| function searchAndReplaceNumberVehicle(arrayIds, URL_ROUTE) { | ||
| let replaced = []; |
| } | ||
|
|
||
| function getIds(resRoutes) { | ||
| const array = resRoutes.items; |
There was a problem hiding this comment.
Puedes hacer el return directamente!
| document.querySelector('#spinner').style.display = 'none'; | ||
| } else { | ||
| document.querySelector('#spinner').style.display = 'none'; | ||
| document.querySelector('#map').innerHTML = '<p style="position: absolute; transform: translate(-50%, -50%); top: 50%; left: 50%;">Algo ha ido mal, vuelve a intentarlo mas tarde</p>'; |
There was a problem hiding this comment.
Casi mejor tener un div oculto por defecto con este mensaje y mostrarlo cuando el map no funcione

Ejercicio metro L.A