Skip to content

Commit

Permalink
Merge pull request #16 from okx/fix/abortSignalFunc
Browse files Browse the repository at this point in the history
fix: fix up abort signal function
  • Loading branch information
fwx5618177 authored Dec 19, 2024
2 parents 9a7cb43 + a9ecc9d commit 3a52935
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/dex-widget/src/fetchDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const domains = [
'https://www.okx.ac',
];

AbortSignal.timeout ??= function timeout(ms) {
const abortSignalTimeout = (ms: number): AbortSignal => {
const ctrl = new AbortController();
setTimeout(() => ctrl.abort(), ms);
return ctrl.signal;
Expand All @@ -13,7 +13,7 @@ const checkDomain = (domain: string, timeout = 5000): Promise<void | string> =>
if (!domain) {
return Promise.resolve();
}
return fetch(domain, { signal: AbortSignal.timeout(timeout) })
return fetch(domain, { signal: abortSignalTimeout(timeout) })
.then(response => {
if (response.ok) {
return domain;
Expand Down

0 comments on commit 3a52935

Please sign in to comment.