mirror of
https://github.com/expo/appjs25-eas-update-workshop-code.git
synced 2026-11-14 17:48:09 -10:00
21 lines
615 B
TypeScript
21 lines
615 B
TypeScript
import { checkForUpdateAsync, fetchUpdateAsync } from "expo-updates";
|
|
|
|
// Wrap async expo-updates functions (errors are surfaced in useUpdates() hook so can be ignored)
|
|
export const checkForUpdate: () => Promise<string | undefined> = async () => {
|
|
try {
|
|
const result = await checkForUpdateAsync();
|
|
return result.reason;
|
|
} catch (_error) {
|
|
if (__DEV__) {
|
|
alert(_error); // checkError not surfaced in dev mode
|
|
}
|
|
}
|
|
};
|
|
|
|
export const downloadUpdate = () =>
|
|
fetchUpdateAsync().catch((_error) => {
|
|
if (__DEV__) {
|
|
alert(_error); // downloadError not surfaced in dev mode
|
|
}
|
|
});
|