I have been working on my Weather App, but something that has been frustrating between my edits is the amount of time it takes to pull the weather information. Could someone help me understand why this is happening?
Here is my project - https://codepen.io/aTmb405/pen/aYGKXm?editors=0010
Try to close the statements with a semicolon.
Thank you, but that doesn’t seem to have helped much. I wonder if it is something else
It’s just the nature of calling an api. You don’t really know when you’ll get that information back.
Whether the server is under load or network conditions to and from that server are less than ideal, that’s what makes asynchronous calls harder to deal with.
I believe the fcc weather api uses the openweathermap api which does have limits to the amount of calls per minute which may be getting hit since presumably everyone is sharing that same api key. So it could be that as well.
I have noticed that using the openweathermap api as opposed to the fcc one does avoid the bug that defaults to some town in Japan sometimes. It doesn’t take long to get it up and running either.
why not just use a spinner/loader? You just show it when the data is loading and hide it when its done loading.
Thanks! This is all new to me, but that was a helpful explanation. I will have to try out the openweathermap api.
That’s a good idea. I have seen it on some other’s projects, and I’m looking into how to do it myself.