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
Call .cancel() on the input on every timeout and abort (#47) d938bcd
Before, only a timeout without a fallback called it. Now a timeout with a fallback, an abort of signal, and an already aborted signal also call it.
Cancellation is best-effort. If .cancel() throws, the error is ignored and the promise still settles. Before, the error escaped the timer as an uncaught exception and the promise never settled.
.cancel() runs after the outcome is decided, so it cannot change the outcome.
A fallback that returns the input itself now gets a cancelled input.
Reject with the exact abort reason, even when it is nullf2b3ae3
controller.abort(null) used to reject with a generic AbortError.
Improvements
Only create a TimeoutError when the timeout can reject with it bcc57d3
Capturing a stack trace is expensive, and most promises settle before the timeout.