U
U
Utopia2020-04-14 15:02:53
JavaScript
Utopia, 2020-04-14 15:02:53

Timeout for asynchronous js request. How best to implement?

There is an asynchronous js request to the server that responds in 5 seconds. How to reset it by timeout after 2 seconds.
In the sense that if the request lasts longer than 2 seconds, then do not wait for a response. After all, the request has already entered the queue and the callback will be executed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-04-14
@Utopia

https://learn.javascript.ru/fetch-abortion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question