1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-29 20:43:09 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

chore: lint

This commit is contained in:
sunnylqm
2024-03-07 22:11:44 +08:00
parent 22c4b01ead
commit 94cf96a0e5
13 changed files with 627 additions and 383 deletions

View File

@@ -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,
);
};