UNPKG

nativescript-code-push

Version:
83 lines (82 loc) 3.18 kB
/// <reference path="code-push-lib.d.ts" /> export declare enum InstallMode { /** * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately. */ IMMEDIATE, /** * The update is downloaded but not installed immediately. The new content will be available the next time the application is started. */ ON_NEXT_RESTART, /** * The update is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first. */ ON_NEXT_RESUME } export declare enum SyncStatus { /** * The application is up to date. */ UP_TO_DATE, /** * An update is available, it has been downloaded, unzipped and copied to the deployment folder. * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources. */ UPDATE_INSTALLED, /** * An optional update is available, but the user declined to install it. The update was not downloaded. */ UPDATE_IGNORED, /** * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update. * The console logs should contain more information about what happened. No update has been applied in this case. */ ERROR, /** * There is an ongoing sync in progress, so this attempt to sync has been aborted. */ IN_PROGRESS, /** * Intermediate status - the plugin is about to check for updates. */ CHECKING_FOR_UPDATE, /** * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled. */ AWAITING_USER_ACTION, /** * Intermediate status - the update package is about to be downloaded. */ DOWNLOADING_PACKAGE, /** * Intermediate status - the update package is about to be installed. */ INSTALLING_UPDATE } export interface DownloadProgress { totalBytes: number; receivedBytes: number; } export declare class CodePush { static CURRENT_HASH_KEY: string; private static PENDING_HASH_KEY; private static CLEAN_KEY; private static BINARY_FIRST_RUN_KEY; private static UNCONFIRMED_INSTALL_KEY; private static syncInProgress; static sync(options: SyncOptions, syncCallback?: SuccessCallback<SyncStatus>, downloadProgress?: SuccessCallback<DownloadProgress>): void; static checkForUpdate(deploymentKey: string, serverUrl?: string): Promise<IRemotePackage | undefined>; private static getCurrentPackage; private static notifyApplicationReady; private static killApp; private static cleanPackagesIfNeeded; private static isBinaryFirstRun; /** * This key exists until a restart is done (removed by native upon start). * @returns {boolean} */ private static hasPendingHash; private static markBinaryAsFirstRun; private static firstLaunchValue; private static markPackageAsFirstRun; }