Message from JavaScript discussions

May 2017

— How?


Externally you can access a method named reject which makes a new promise, I guess not good enough though

— That doesn't reject it

— Really?

— Just makes a new one and rejects it, haha

— That's just a static method

— It doesn't exist on promise objects, only the constructor

— The problem is getting the abort to the underlying native code

— Yup

— Well, in a shim you could attach cancel to a xhr.abort

— Whatever mechanism timeout uses


const xhr = (url) => {
const x = new XMLHttpRequest();
const p = new Promise(...);
p.cancel = () => x.abort();
return p;

Message permanent page