News for hackers. Stuff that matters.
Re:Show HN: Cancelable async primitives for JavaScript by kansface on Tuesday August 08, 2017 @07:43PM (#14964123)
We use 'fetch' extensively. It does not support cancellation or timeouts, although you can implement the later as a Promise.race with a setTimeout.
Re:Show HN: Cancelable async primitives for JavaScript by Mitranim on Tuesday August 08, 2017 @08:31PM (#14964433)
Not good enough. Each ongoing request eats machine resources and counts towards the browser request limit (6 or so). Cancelation must release the underlying resources, which XMLHttpRequest allows you to do. By being promise-based, fetch is fundamentally broken. It's a dead-on-arrival tool.
Re:Show HN: Cancelable async primitives for JavaScript by Matthias247 on Wednesday August 09, 2017 @04:45AM (#14966672)
I wouldn't be that harsh. even if it doesn't support cancellation today the support can be added later, eg through an optional CancellationToken parameter. This is eg how .Net Apis have added cancellation support. I would agree that cancellation would be good to have for lots of applications, but others will also be fine without it
Re:Show HN: Cancelable async primitives for JavaScript by coldtea on Wednesday August 09, 2017 @04:43AM (#14966661)
>Each ongoing request eats machine resources and counts towards the browser request limit (6 or so).

And in most cases this doesn't matter at all.

Re:Show HN: Cancelable async primitives for JavaScript by Mitranim on Wednesday August 09, 2017 @05:25AM (#14966878)
Agreed, often it doesn't matter. Sometimes it DOES matter (high latency / low bandwidth / weak device), and then your program is slower than it could be. Why not pursue async primitives that let you manage resources properly at no downside?
Re:Show HN: Cancelable async primitives for JavaScript by abritinthebay on Tuesday August 08, 2017 @09:51PM (#14964867)
If by dead on arrival you mean incredibly useful, yes.