I’m running an HTTP server with python -m http.server that’s serving my ressources.
Here’s my layout :
dist/
bundle.js
index.html
style.css
assets/
tracks/
listing.json
I have the following code :
fetch("http://localhost:8000/assets/tracks/listing.json")
.then(() => console.log("Got it"))
So far so good, it prints ‘Got it’ after a few ms.
But when I do that :
fetch("http://localhost:8000/assets/tracks/listing.json")
.then(() => console.log("Got it"))
while (true) {}
It just somehow freezes without printing anything, and the page has that little blue circle indicating it’s still loading.
I have a way of not using that while loop, and, so to say, to solve the problem.
But I think this has something to do with how asynchronous processes work in Javascript, and I think it could be good for me to learn a bit more about exactly why it doesn’t work.
Thanks !