Switch to Promises instead of callbacks #166

Closed
opened 2018-06-17 21:51:43 -05:00 by BehindTheMath · 5 comments
BehindTheMath commented 2018-06-17 21:51:43 -05:00 (Migrated from github.com)

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.

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.
BehindTheMath commented 2019-03-10 13:34:54 -05:00 (Migrated from github.com)

Promises will make cancelling the XHRs more complicated, since currently, native Promises cannot be canceled.

Promises will make cancelling the XHRs more complicated, since currently, native Promises cannot be canceled.
kinooyume commented 2021-02-19 05:26:08 -05:00 (Migrated from github.com)

What do you mean ? you can "cancel" a Promise with reject.

What do you mean ? you can "cancel" a Promise with reject.
BehindTheMath commented 2021-02-19 14:02:55 -05:00 (Migrated from github.com)

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.

You can reject a Promise, but you cannot abort the fetch request without [AbortControllers](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), which is a newer API, and is not supported by IE.
imannms commented 2021-03-27 12:25:14 -05:00 (Migrated from github.com)
@BehindTheMath What about this? https://www.npmjs.com/package/abortcontroller-polyfill
BehindTheMath commented 2021-03-30 21:08:07 -05:00 (Migrated from github.com)

This "polyfill" doesn't actually close the connection when the request is aborted

>This "polyfill" doesn't actually close the connection when the request is aborted
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#166