r/learnjavascript • u/sebastienfilion • Jun 14 '21
With the release 1.11 of the JavaScript and TypeScript runtime Deno , you can leverage the `AbortController` signal! Paired with `fetch`, you can abort a slow request either with a timeout or as a side-effect of user input.
126
Upvotes
1
u/mattcoady Jun 15 '21
FYI, Deno not required, same syntax. MDN docs on AbortController: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
3
3
u/noXi0uz Jun 15 '21
You can do this in the browser and in nodejs too. Axios has a similar syntax for it.
9
u/sebastienfilion Jun 14 '21
If you are interested to learn more about this feature; I made an entire video on my Youtube channel about the highlights of the release 1.11 of Deno . You can check it out, here: https://youtu.be/8RKpRMuUOHM