![]() There is also a rather fetching polyfill by GitHub that you can use today. If you've never used Promises before, check out Introduction to JavaScript Promises. Let's start by comparing a simple example implemented with an XMLHttpRequest and then with fetch. We just want to request a URL, get a response and parse it as JSON. XMLHttpRequest #Īn XMLHttpRequest would need two listeners to be set to handle the success and error cases and a call to open() and send(). Why is "no-cors" supported in service workers but not the window? #įunction reqListener ( ) ) FAQ # How do I cancel a fetch() request? #Īt the moment there is no way to cancel a fetch, but this is being discussed on GitHub. This is due to a security concern, you can learn more here.
0 Comments
Leave a Reply. |