@hot-updater/react-native
Version:
React Native OTA solution for self-hosted
31 lines • 1.24 kB
TypeScript
import type { AppUpdateInfo, UpdateBundleParams } from "@hot-updater/core";
import { type UpdateSource } from "./fetchUpdateInfo";
export interface CheckForUpdateOptions {
source: UpdateSource;
requestHeaders?: Record<string, string>;
onError?: (error: Error) => void;
/**
* The timeout duration for the request.
* @default 5000
*/
requestTimeout?: number;
}
export type CheckForUpdateResult = AppUpdateInfo & {
/**
* Updates the bundle.
* This method is equivalent to `HotUpdater.updateBundle()` but with all required arguments pre-filled.
*/
updateBundle: () => Promise<boolean>;
};
export declare function checkForUpdate(options: CheckForUpdateOptions): Promise<CheckForUpdateResult | null>;
export interface GetUpdateSourceOptions {
/**
* The update strategy to use.
* @description
* - "fingerprint": Use the fingerprint hash to check for updates.
* - "appVersion": Use the target app version to check for updates.
*/
updateStrategy: "appVersion" | "fingerprint";
}
export declare const getUpdateSource: (baseUrl: string, options: GetUpdateSourceOptions) => (params: UpdateBundleParams) => string;
//# sourceMappingURL=checkForUpdate.d.ts.map