Run function while async function is pending
I want to learn how can I run a function while part of my code is still running, like an async function or some loop that can take some time to finish.
For example, while fetching data from an API, I want it to display a loading animation or message while the async function is pending
4 Replies
I thought in something like this but this is not a proper way, I am sure.
I want that message to display after the user inputs the "word", and make it disappear when the "fetch' function and the new DOM elements are done
that is 100% the way that is done. You set the loading thing up, then do the fetch, and in the .then, you unset it
Really?
That makes things easier then
yup