Not long after fetch()
was introduced the question was raised how to terminate a fetch. Of the various options the best seemed to be invoking a method on the returned promise (let f = fetch(…); f.terminate()
). However, irrespective of which of the alternatives is chosen, what happens to the promise?
Kris Kowel has some rather interesting reading on the subject in A General Theory of Reactivity and cancelation.md. Promises/A+ has a repository with a bunch of open issues with useful discussion. After discussing it further with Domenic and Ben on IRC, rejection no longer feels like the natural solution. Explicit termination of a fetch will rarely share code with the generic handler for network errors. On Twitter Kris offers [f]orever pending is ok
, which we might well go with.