Re:Free React.js Fundamentals Course
by threatofrain on Tuesday March 01, 2016 @11:54PM
(#11208158)
I've been hesitant of Fetch() because of the lack of timeout; has anyone been able to successfully get around this issue?
[ Parent
| on HN ]
Yeah, this is an important question. I don't have answer for you and neither do the people in charge of the fetch API. It's an issue with promises not being cancelable. There's probably a reasonable argument that promises just aren't that great because you can only resolve or reject.
Personally I don't see a huge problem with either resolving or rejecting with a message about the cause of the result. Others see it differently but they haven't been able to make any progress on a major problem.
If you want to avoid this altogether there's no reason why you can't use a different library.
Re:Free React.js Fundamentals Course
by EvanPlaice on Wednesday March 02, 2016 @03:12AM
(#11208686)
What about using observables? Unlike promises, they can be cancelled at any time.
Rxjs provides the observable data type. The extensions are functional reactive operators. There are operators used to retry, throttle, filter, debounce, etc.
Angular2's http module is already based on Rxjs observables for this exact reason.
Re:Free React.js Fundamentals Course
by bostonvaulter2 on Wednesday March 02, 2016 @03:09AM
(#11208673)
I don't have an answer for you but I dislike that Fetch() doesn't currently have any support for progress events. So say good-bye to your file-upload progress bar!