pjax
pjax copied to clipboard
Switch to Promises instead of callbacks
Along with #109, we should consider switching to use Promises instead of callbacks. Most environments support it by now, and we can use a polyfill for those that don't.
Promises will make cancelling the XHRs more complicated, since currently, native Promises cannot be canceled.
What do you mean ? you can "cancel" a Promise with reject.
You can reject a Promise, but you cannot abort the fetch request without AbortControllers, which is a newer API, and is not supported by IE.
@BehindTheMath What about this? https://www.npmjs.com/package/abortcontroller-polyfill
This "polyfill" doesn't actually close the connection when the request is aborted