UNPKG

@silicon.js/app-updates

Version:

lightweight react package for checking app updates from ios app store and android play store using react context

30 lines (25 loc) 670 B
import { Context, createContext } from 'react'; export interface AppUpdatesInfo { currentVersion: string; latestVersion: string | null; isNewVersionAvailable: boolean; isChecking: boolean; lastChecked: Date | null; error: string | null; } export interface AppUpdatesContextType { details: AppUpdatesInfo; checkVersion: () => Promise<void>; } const AppUpdatesContext: Context<AppUpdatesContextType> = createContext<AppUpdatesContextType>({ details: { currentVersion: '', latestVersion: null, isNewVersionAvailable: false, isChecking: false, lastChecked: null, error: null, }, checkVersion: async () => {}, }); export default AppUpdatesContext;