3 ms·
The way to handle this case is to use Promise.race with 2 promises. The first promise is your logic. The second promise is rejected after a timeout. For more de
by jdesjean 10y ago
The way to handle this case is to use Promise.race with 2 promises. The first promise is your logic. The second promise is rejected after a timeout. For more detail read the section "never calling the callback" from "you don't know js" book on "async" in chapter 3
https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch3.md https://github.com/getify/You-Dont-Know-JS/blob/master/async...
- fareesh 10y agoThanks I'll check it out
- soft_dev_person 10y agoBut that doesn't actually cancel the request, and thusly the data is downloaded anyway? Or am I missing something?