File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ export default function pTimeout(promise, options) {
5050 // We create the error outside of `setTimeout` to preserve the stack trace.
5151 const timeoutError = new TimeoutError ( ) ;
5252
53- timer = customTimers . setTimeout ( ( ) => {
53+ // `.call(undefined, ...)` is needed for custom timers to avoid context issues
54+ timer = customTimers . setTimeout . call ( undefined , ( ) => {
5455 if ( fallback ) {
5556 try {
5657 resolve ( fallback ( ) ) ;
@@ -85,7 +86,8 @@ export default function pTimeout(promise, options) {
8586 } ) ;
8687
8788 cancelablePromise . clear = ( ) => {
88- customTimers . clearTimeout ( timer ) ;
89+ // `.call(undefined, ...)` is needed for custom timers to avoid context issues
90+ customTimers . clearTimeout . call ( undefined , timer ) ;
8991 timer = undefined ;
9092 } ;
9193
You can’t perform that action at this time.
0 commit comments