You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings! thanks for really great and simple library, this is exactly how Promise Abort API should be implemented in my opinion! Simple, obvious and extremely useful!
I understand why we redefine AbortSignal and AbortController (because of abort(reason) lack, by the way - I think reason can be exposed also as signal.reason (in case of signal.aborted - like in https://github.com/getify/CAF#signalaborted-and-signalreason).
My question is about Fetch API from example. Why original signal can't be passed to Fetch API? Is it some interface incompatibility, or internal instanceof check? Even if it's impossible for some reason, IMHO example should explicitly explain why.
const promise = new AbortablePromise((resolve, reject, signal) => {
const url = `/`;
const controller = new AbortController();
fetch(url, { signal: controller.signal }).then(resolve, reject);
signal.onabort = controller.abort.bind(controller);
})
// --- Why not
const promise = new AbortablePromise((resolve, reject, signal) => {
fetch(url, { signal }).then(resolve, reject)
})
The text was updated successfully, but these errors were encountered:
Greetings! thanks for really great and simple library, this is exactly how Promise Abort API should be implemented in my opinion! Simple, obvious and extremely useful!
I understand why we redefine
AbortSignal
andAbortController
(because ofabort(reason)
lack, by the way - I think reason can be exposed also assignal.reason
(in case of signal.aborted - like in https://github.com/getify/CAF#signalaborted-and-signalreason).My question is about Fetch API from example. Why original signal can't be passed to Fetch API? Is it some interface incompatibility, or internal
instanceof
check? Even if it's impossible for some reason, IMHO example should explicitly explain why.The text was updated successfully, but these errors were encountered: