File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ export async function getLinkPreview(
404
404
}
405
405
406
406
const timeout = options ?. timeout ?? 3000 ; // 3 second timeout default
407
- const controller = new ( AbortController || AbortControllerPolyfill ) ( ) ;
407
+ const controller = createAbortController ( ) ;
408
408
const timeoutCounter = setTimeout ( ( ) => controller . abort ( ) , timeout ) ;
409
409
410
410
const fetchOptions = {
@@ -488,3 +488,10 @@ export async function getPreviewFromContent(
488
488
489
489
return parseResponse ( response , options ) ;
490
490
}
491
+
492
+
493
+ function createAbortController ( ) : AbortController | AbortControllerPolyfill {
494
+ return typeof AbortController == 'undefined'
495
+ ? new AbortControllerPolyfill ( )
496
+ : new AbortController ( ) ;
497
+ }
You can’t perform that action at this time.
0 commit comments