mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-29 20:43:09 +08:00
chore: lint
This commit is contained in:
@@ -12,9 +12,8 @@ const ping = async (url: string) =>
|
||||
Promise.race([
|
||||
fetch(url, {
|
||||
method: 'HEAD',
|
||||
redirect: 'follow',
|
||||
}).then(({ status }) => status === 200),
|
||||
new Promise<false>((r) => setTimeout(() => r(false), 2000)),
|
||||
new Promise<false>(r => setTimeout(() => r(false), 2000)),
|
||||
]);
|
||||
|
||||
const canUseGoogle = ping('https://www.google.com');
|
||||
@@ -23,7 +22,7 @@ export const testUrls = async (urls?: string[]) => {
|
||||
if (!urls?.length || (await canUseGoogle)) {
|
||||
return null;
|
||||
}
|
||||
return Promise.race(urls.map((url) => ping(url).then(() => url))).catch(
|
||||
return Promise.race(urls.map(url => ping(url).then(() => url))).catch(
|
||||
() => null,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user