mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-08 23:25:15 +08:00
test cdn urls
This commit is contained in:
@@ -23,10 +23,9 @@ const ping =
|
||||
new Promise(r => setTimeout(() => r(null), 2000)),
|
||||
]);
|
||||
|
||||
const canUseGoogle = ping('https://www.google.com');
|
||||
|
||||
export const testUrls = async (urls?: string[]) => {
|
||||
if (!urls?.length || (await canUseGoogle)) {
|
||||
if (!urls?.length) {
|
||||
return null;
|
||||
}
|
||||
return Promise.race(urls.map(ping)).catch(() => null);
|
||||
|
Reference in New Issue
Block a user