Hello @borisyordanov @sorinr.
First of all, thanks for your feedbacks and sorry for delay. I refactored my challenge, check again if you could.
Yes, I have been studying only vanilla and I realized that I need to practice a little of jQuery, so I seized the opportunity to do it.
Yeah, thanks for recomendation. I have already changed the code. Please, check my challenge again if possible
Except pieces of code where I did DOM queries I did not find other variables where the better choice is to become them global and give up encapsulation. Can you show me the exact part of my code to do it if still exists?
On previous block’s code I put a comment line before to explain it. I just tried to keep this pattern. But you are right, in that case was so obvious.
I realize that navigator geolocation is too slow and I solve it using localStorage:
- First I check if there are coordinates stored. If true, I immediately run my code to show the result
- For all request I always get geolocation’s user, around it and and compare with old coordinates.
- If the coordinates are different, save new coordinates and run the code again.
So, it solve 2 problems:
- High load time to show the weather condition for user. It will be slow only on the first time
- Update weather condition values automatically if the user changed location compared the last time he visited the page (a user visited the page, close the notebook, moved to other country and revisited the page)