News for hackers. Stuff that matters.
Re:JQuery++ by k__ on Friday August 05, 2016 @11:21AM (#12232976)
True, I hope these pains will be gone with fetch.
Re:JQuery++ by nilliams on Friday August 05, 2016 @02:34PM (#12234761)
Unfortunately Promises need to be fixed before fetch will be sane and here's how the promises spec currently looks:

- unhandled errors silently swallowed [1] (this is the case for the most popular polyfill [1] too - the one recommended by fetch polyfills, BEWARE [3])

- no 'finally' method, despite pretty much everything in a UI needing some common 'cleanup' after e.g. a fetch()

- not cancellable

Right now you're better off with `$.ajax` (maybe make a custom build of jQuery) or a promise-like library like reqwest [2], rather than fighting with fetch.

[1] https://github.com/stefanpenner/es6-promise/issues/70#issuec...

[2] https://github.com/ded/reqwest

[3] http://requirebin.com/?gist=8f13d5147c1c252ab1691115bfa8b7c5

Re:JQuery++ by k__ on Saturday August 06, 2016 @06:05AM (#12237629)
I don't know why they pushing Observables AND Promises in ECMAScript. Observables a much more flexible and don't have these problems :/
Re:JQuery++ by imaginology on Friday August 05, 2016 @11:24AM (#12233005)
That depends on whether the Promise specification gets cancellations. I like fetch's clean API, but being able to cancel my ajax requests is essential.
Re:JQuery++ by azernik on Friday August 05, 2016 @11:58AM (#12233306)
Cancel the requests, or cancel the callback chain that's set up to fire when they complete?
Re:JQuery++ by k__ on Friday August 05, 2016 @11:31AM (#12233067)
Essential? Why?
Re:JQuery++ by TheAceOfHearts on Monday August 08, 2016 @05:50PM (#12251122)
The big use-case I can think of is file uploads. If someone is uploading a large file, you wanna be able to cancel it.