New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-code-push

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-code-push - npm Package Compare versions

Comparing version 1.1.2-beta to 1.2.0-beta

CodePushDownloadHandler.m

153

CodePush.ios.js

@@ -63,3 +63,3 @@ 'use strict';

.then((failedUpdate) => {
localPackage.failedApply = failedUpdate;
localPackage.failedInstall = failedUpdate;
return NativeCodePush.isFirstRun(localPackage.packageHash);

@@ -102,3 +102,3 @@ })

// Ignore updates that require a newer app version,
// since the end-user couldn't reliably apply it
// since the end-user couldn't reliably install it
if (!update || update.updateAppVersion) {

@@ -112,3 +112,3 @@ return resolve(null);

.then((isFailedHash) => {
update.failedApply = isFailedHash;
update.failedInstall = isFailedHash;
resolve(update);

@@ -123,2 +123,7 @@ })

/* Logs messages to console with the [CodePush] prefix */
function log(message) {
console.log(`[CodePush] ${message}`)
}
/**

@@ -133,30 +138,83 @@ * The sync method provides a simple, one-line experience for

*/
function sync(options = {}) {
function sync(options = {}, syncStatusChangeCallback, downloadProgressCallback) {
var syncOptions = {
descriptionPrefix: " Description: ",
appendReleaseDescription: false,
ignoreFailedUpdates: true,
mandatoryContinueButtonLabel: "Continue",
mandatoryUpdateMessage: "An update is available that must be installed.",
optionalIgnoreButtonLabel: "Ignore",
optionalInstallButtonLabel: "Install",
optionalUpdateMessage: "An update is available. Would you like to install it?",
installMode: CodePush.InstallMode.ON_NEXT_RESTART,
rollbackTimeout: 0,
updateDialog: null,
updateTitle: "Update available",
...options
};
syncStatusChangeCallback = typeof syncStatusChangeCallback == "function"
? syncStatusChangeCallback
: function(syncStatus) {
switch(syncStatus) {
case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
log("Checking for update.");
break;
case CodePush.SyncStatus.AWAITING_USER_ACTION:
log("Awaiting user action.");
break;
case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
log("Downloading package.");
break;
case CodePush.SyncStatus.INSTALLING_UPDATE:
log("Installing update.");
break;
case CodePush.SyncStatus.UP_TO_DATE:
log("App is up to date.");
break;
case CodePush.SyncStatus.UPDATE_IGNORED:
log("User cancelled the update.");
break;
case CodePush.SyncStatus.UPDATE_INSTALLED:
/*
* If the install mode is IMMEDIATE, this will not get returned as the
* app will be restarted to a new Javascript context.
*/
if (syncOptions.installMode == CodePush.InstallMode.ON_NEXT_RESTART) {
log("Update is installed and will be run on the next app restart.");
} else {
log("Update is installed and will be run when the app next resumes.");
}
break;
case CodePush.SyncStatus.UNKNOWN_ERROR:
log("An unknown error occurred.");
break;
}
};
downloadProgressCallback = typeof downloadProgressCallback == "function"
? downloadProgressCallback
: function(downloadProgress) {
log(`Expecting ${downloadProgress.totalBytes} bytes, received ${downloadProgress.receivedBytes} bytes.`);
};
return new Promise((resolve, reject) => {
syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE);
checkForUpdate()
.then((remotePackage) => {
if (!remotePackage || (remotePackage.failedApply && syncOptions.ignoreFailedUpdates)) {
var doDownloadAndInstall = () => {
syncStatusChangeCallback(CodePush.SyncStatus.DOWNLOADING_PACKAGE);
remotePackage.download(downloadProgressCallback)
.then((localPackage) => {
syncStatusChangeCallback(CodePush.SyncStatus.INSTALLING_UPDATE);
return localPackage.install(syncOptions.rollbackTimeout, syncOptions.installMode, () => {
syncStatusChangeCallback(CodePush.SyncStatus.UPDATE_INSTALLED);
resolve(CodePush.SyncStatus.UPDATE_INSTALLED);
});
})
.catch(reject)
.done();
}
if (!remotePackage || (remotePackage.failedInstall && syncOptions.ignoreFailedUpdates)) {
syncStatusChangeCallback(CodePush.SyncStatus.UP_TO_DATE);
resolve(CodePush.SyncStatus.UP_TO_DATE);
}
else {
else if (syncOptions.updateDialog) {
syncOptions.updateDialog = Object.assign(CodePush.DEFAULT_UPDATE_DIALOG, syncOptions.updateDialog);
var message = null;

@@ -167,9 +225,3 @@ var dialogButtons = [

onPress: () => {
remotePackage.download()
.then((localPackage) => {
resolve(CodePush.SyncStatus.UPDATE_APPLIED)
return localPackage.apply(syncOptions.rollbackTimeout);
})
.catch(reject)
.done();
doDownloadAndInstall();
}

@@ -180,7 +232,7 @@ }

if (remotePackage.isMandatory) {
message = syncOptions.mandatoryUpdateMessage;
message = syncOptions.updateDialog.mandatoryUpdateMessage;
dialogButtons[0].text = syncOptions.mandatoryContinueButtonLabel;
} else {
message = syncOptions.optionalUpdateMessage;
dialogButtons[0].text = syncOptions.optionalInstallButtonLabel;
message = syncOptions.updateDialog.optionalUpdateMessage;
dialogButtons[0].text = syncOptions.updateDialog.optionalInstallButtonLabel;

@@ -190,3 +242,3 @@ // Since this is an optional update, add another button

dialogButtons.push({
text: syncOptions.optionalIgnoreButtonLabel,
text: syncOptions.updateDialog.optionalIgnoreButtonLabel,
onPress: () => resolve(CodePush.SyncStatus.UPDATE_IGNORED)

@@ -198,10 +250,16 @@ });

// explicitly chose to display it, then set that as the message
if (syncOptions.appendReleaseDescription && remotePackage.description) {
message += `${syncOptions.descriptionPrefix} ${remotePackage.description}`;
if (syncOptions.updateDialog.appendReleaseDescription && remotePackage.description) {
message += `${syncOptions.updateDialog.descriptionPrefix} ${remotePackage.description}`;
}
syncStatusChangeCallback(CodePush.SyncStatus.AWAITING_USER_ACTION);
AlertIOS.alert(syncOptions.updateTitle, message, dialogButtons);
} else {
doDownloadAndInstall();
}
})
.catch(reject)
.catch((error) => {
syncStatusChangeCallback(CodePush.SyncStatus.UNKNOWN_ERROR);
reject(error);
})
.done();

@@ -215,12 +273,33 @@ });

getCurrentPackage: getCurrentPackage,
log: log,
notifyApplicationReady: NativeCodePush.notifyApplicationReady,
setUpTestDependencies: setUpTestDependencies,
sync: sync,
InstallMode: {
IMMEDIATE: NativeCodePush.codePushInstallModeImmediate, // Restart the app immediately
ON_NEXT_RESTART: NativeCodePush.codePushInstallModeOnNextRestart, // Don't artificially restart the app. Allow the update to be "picked up" on the next app restart
ON_NEXT_RESUME: NativeCodePush.codePushInstallModeOnNextResume // Restart the app the next time it is resumed from the background
},
SyncStatus: {
UP_TO_DATE: 0, // The running app is up-to-date
UPDATE_IGNORED: 1, // The app had an optional update and the end-user chose to ignore it
UPDATE_APPLIED: 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
CHECKING_FOR_UPDATE: 0,
AWAITING_USER_ACTION: 1,
DOWNLOADING_PACKAGE: 2,
INSTALLING_UPDATE: 3,
UP_TO_DATE: 4, // The running app is up-to-date
UPDATE_IGNORED: 5, // The app had an optional update and the end-user chose to ignore it
UPDATE_INSTALLED: 6, // The app had an optional/mandatory update that was successfully downloaded and is about to be installed.
UNKNOWN_ERROR: -1
},
DEFAULT_UPDATE_DIALOG: {
appendReleaseDescription: false,
descriptionPrefix: " Description: ",
mandatoryContinueButtonLabel: "Continue",
mandatoryUpdateMessage: "An update is available that must be installed.",
optionalIgnoreButtonLabel: "Ignore",
optionalInstallButtonLabel: "Install",
optionalUpdateMessage: "An update is available. Would you like to install it?",
updateTitle: "Update available",
}
};
module.exports = CodePush;
module.exports = CodePush;
var extend = require("extend");
var { NativeAppEventEmitter } = require("react-native");

@@ -8,3 +9,3 @@ module.exports = (NativeCodePush) => {

},
download: function download() {
download: function download(downloadProgressCallback) {
if (!this.downloadUrl) {

@@ -14,2 +15,11 @@ return Promise.reject(new Error("Cannot download an update without a download url"));

var downloadProgressSubscription;
if (downloadProgressCallback) {
// Use event subscription to obtain download progress.
downloadProgressSubscription = NativeAppEventEmitter.addListener(
"CodePushDownloadProgress",
downloadProgressCallback
);
}
// Use the downloaded package info. Native code will save the package info

@@ -19,3 +29,9 @@ // so that the client knows what the current package version is.

.then((downloadedPackage) => {
downloadProgressSubscription && downloadProgressSubscription.remove();
return extend({}, downloadedPackage, local);
})
.catch((error) => {
downloadProgressSubscription && downloadProgressSubscription.remove();
// Rethrow the error for subsequent handlers down the promise chain.
throw error;
});

@@ -26,4 +42,10 @@ }

var local = {
apply: function apply(rollbackTimeout = 0) {
return NativeCodePush.applyUpdate(this, rollbackTimeout);
install: function install(rollbackTimeout = 0, installMode = NativeCodePush.codePushInstallModeOnNextRestart, updateInstalledCallback) {
return NativeCodePush.installUpdate(this, rollbackTimeout, installMode)
.then(function() {
updateInstalledCallback && updateInstalledCallback();
if (installMode == NativeCodePush.codePushInstallModeImmediate) {
NativeCodePush.restartApp(rollbackTimeout);
}
});
}

@@ -30,0 +52,0 @@ };

{
"name": "react-native-code-push",
"version": "1.1.2-beta",
"version": "1.2.0-beta",
"description": "React Native plugin for the CodePush service",

@@ -5,0 +5,0 @@ "main": "CodePush.ios.js",

@@ -5,5 +5,5 @@ # React Native plugin for CodePush

The CodePush React Native API provides two primary mechanisms for discovering updates and dynamically applying them within your apps:
The CodePush React Native API provides two primary mechanisms for discovering updates and dynamically installing them within your apps:
1. [**Sync mode**](#codepushsync), which allows you to call a single method--presumably as part of mounting your app's root component or in response to a button click--that will automatically check for an update, download and apply it, while respecting the policies and metadata associated with each release (e.g. if the release is mandatory then it doesn't give the end-user the option to ignore it)
1. [**Sync mode**](#codepushsync), which allows you to call a single method--presumably as part of mounting your app's root component or in response to a button click--that will automatically check for an update, download and install it, while respecting the policies and metadata associated with each release (e.g. if the release is mandatory then it doesn't give the end-user the option to ignore it)
2. [**Advanced mode**](#codepushcheckforupdate), which provides a handful of "low-level" methods which give you complete control over the update experience, at the cost of added complexity.

@@ -77,3 +77,3 @@

This change configures your app to always load the most recent version of your app's JS bundle. On the initial launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently applied update.
This change configures your app to always load the most recent version of your app's JS bundle. On the initial launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.

@@ -127,5 +127,5 @@ To let the CodePush runtime know which deployment it should query for updates against, perform the following steps:

* [checkForUpdate](#codepushcheckforupdate): Queries the CodePush service for an update against the configured deployment. This method returns a promise which resolves to a `RemotePackage` that can be subsequently downloaded.
* [getCurrentPackage](#codepushgetcurrentpackage): Gets information about the currently applied package (e.g. description, installation time)
* [notifyApplicationReady](#codepushnotifyapplicationready): Notifies the CodePush runtime that an applied update is considered successful. This is an optional API, but is useful when you want to expicitly enable "rollback protection" in the event that an exception occurs in any code that you've deployed to production
* [sync](#codepushsync): Allows checking for an update, downloading it and applying it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
* [getCurrentPackage](#codepushgetcurrentpackage): Gets information about the currently installed package (e.g. description, installation time)
* [notifyApplicationReady](#codepushnotifyapplicationready): Notifies the CodePush runtime that an installed update is considered successful. This is an optional API, but is useful when you want to expicitly enable "rollback protection" in the event that an exception occurs in any code that you've deployed to production
* [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps

@@ -164,3 +164,3 @@ #### codePush.checkForUpdate

Gets information about the currently applied package (e.g. description, installation time).
Gets information about the currently installed package (e.g. description, installation time).

@@ -175,3 +175,3 @@ This method returns a Promise that resolves with the `LocalPackage` instance that represents the running update. This API is only useful for advanced scenarios, and so many devs won't need to concern themselves with it.

Notifies the CodePush runtime that an update is considered successful, and therefore, a rollback isn't neccessary. Calling this function is required whenever the `rollbackTimeout` parameter is specified when calling either ```LocalPackage.apply``` or `sync`. If you specify a `rollbackTimeout`, and don't call `notifyApplicationReady`, the CodePush runtime will assume that the applied update has failed and roll back to the previous version.
Notifies the CodePush runtime that an update is considered successful, and therefore, a rollback isn't neccessary. Calling this function is required whenever the `rollbackTimeout` parameter is specified when calling either ```LocalPackage.install``` or `sync`. If you specify a `rollbackTimeout`, and don't call `notifyApplicationReady`, the CodePush runtime will assume that the installed update has failed and roll back to the previous version.

@@ -183,9 +183,9 @@ If the `rollbackTimeout` parameter was not specified, the CodePush runtime will not enforce any automatic rollback behavior, and therefore, calling this function is not required and will result in a no-op.

```javascript
codePush.sync(options: Object): Promise<Number>;
codePush.sync(options: Object, syncStatusChangeCallback: function(syncStatus: Number), downloadProgressCallback: function(progress: DownloadProgress)): Promise<Number>;
```
Provides a simple option for checking for an update, displaying a notification to the user, downloading it and then applying it, all while also respecting the policy that your release was published with. This method effectively composes together the "advanced mode" APIs for you, so that you don't need to handle any of the following scenarios yourself:
Provides a simple option for checking for an update, displaying a notification to the user, downloading it and then installing it, all while also respecting the policy that your release was published with. This method effectively composes together the "advanced mode" APIs for you, so that you don't need to handle any of the following scenarios yourself:
1. Checking for an update and displaying a standard confirmation dialog asking if they would like to install it
2. Automatically ignoring updates which have previously failed to apply (due to automatic rollback), and therefore, likely don't make sense trying to apply again (let's blacklist them!)
2. Automatically ignoring updates which have previously failed to install (due to automatic rollback), and therefore, likely don't make sense trying to install again (let's blacklist them!)
3. Looking to see whether an available update is mandatory, and if so, don't give the end-user the choice to ignore it

@@ -198,18 +198,36 @@ 4. Displaying the description of an update to the end-user as part of the install confirmation experience

* __appendReleaseDescription__ (Boolean) - Indicates whether you would like to append the description of an available release to the notification message which is displayed to the end-user. Defaults to `false`.
* __descriptionPrefix__ (String) - Indicates the string you would like to prefix the release description with, if any, when displaying the update notification to the end-user. Defaults to `" Description: "`
* __ignoreFailedUpdates__ (Boolean) - Indicates whether you would like to automatically ignored updates which are available, but have been previously attemped to install, but failed. Defaults to `true`.
* __mandatoryContinueButtonLabel__ (String) - The text to use for the button the end-user must press in order to install a mandatory update. Defaults to `"Continue"`.
* __mandatoryUpdateMessage__ (String) - The text used as the body of an update notification, when the update is specified as mandatory. Defaults to `"An update is available that must be installed."`.
* __optionalIgnoreButtonLabel__ (String) - The text to use for the button the end-user can press in order to ignore an optional update that is available. Defaults to `"Ignore"`.
* __optionalInstallButtonLabel__ (String) - The text to use for the button the end-user can press in order to install an optional update. Defaults to `"Install"`.
* __optionalUpdateMessage__ (String) - The text used as the body of an update notification, when the update is optional. Defaults to `"An update is available. Would you like to install it?"`.
* __rollbackTimeout__ (String) - The number of seconds that you want the runtime to wait after an update has been applied before considering it failed and rolling it back. Defaults to `0`, which disabled rollback protection.
* __updateTitle__ (String) - The text used as the header of an update notification that is displayed to the end-user. Defaults to `"Update available"`.
* __installMode__ (CodePush.InstallMode) - Indicates whether you would like to restart the app immediately after the update has been installed, or wait until the next app resume or restart. Defaults to `CodePush.InstallMode.ON_NEXT_RESTART`
* __rollbackTimeout__ (Number) - The number of seconds that you want the runtime to wait after an update has been installed before considering it failed and rolling it back. Defaults to `0`, which disables rollback protection.
* __updateDialog__ (UpdateDialogOptions) - The options object used to customize the dialog displayed to the user. Unspecified fields in the object provided will default to the values shown below, hence the boolean flag `true`, or any other truthy value will cause the default values below to be used. A falsey value will disable the display of a dialog, in which case updates will be downloaded automatically. Defaults to `null` (do not show a dialog). The list of `UpdateDialogOptions` are as follows:
* __appendReleaseDescription__ (Boolean) - Indicates whether you would like to append the description of an available release to the notification message which is displayed to the end-user. Defaults to `false`.
* __descriptionPrefix__ (String) - Indicates the string you would like to prefix the release description with, if any, when displaying the update notification to the end-user. Defaults to `" Description: "`
* __mandatoryContinueButtonLabel__ (String) - The text to use for the button the end-user must press in order to install a mandatory update. Defaults to `"Continue"`.
* __mandatoryUpdateMessage__ (String) - The text used as the body of an update notification, when the update is specified as mandatory. Defaults to `"An update is available that must be installed."`.
* __optionalIgnoreButtonLabel__ (String) - The text to use for the button the end-user can press in order to ignore an optional update that is available. Defaults to `"Ignore"`.
* __optionalInstallButtonLabel__ (String) - The text to use for the button the end-user can press in order to install an optional update. Defaults to `"Install"`.
* __optionalUpdateMessage__ (String) - The text used as the body of an update notification, when the update is optional. Defaults to `"An update is available. Would you like to install it?"`.
* __updateTitle__ (String) - The text used as the header of an update notification that is displayed to the end-user. Defaults to `"Update available"`.
In addition, the method also recieves two function arguments which serve as event handlers which are called at various points in the sync process:
* __syncStatusChangeCallback__ (function(syncStatus: Number)) - Called when the sync process moves to a different step. Below is the list of possible SyncStatus values:
* __CodePush.SyncStatus.CHECKING_FOR_UPDATE__ *(0)* - Querying the CodePush server for an update.
* __CodePush.SyncStatus.AWAITING_USER_ACTION__ *(1)* - Waiting for a response from the user (e.g. a confirmation dialog).
* __CodePush.SyncStatus.DOWNLOADING_PACKAGE__ *(2)* - Downloading the updated package from the CodePush server.
* __CodePush.SyncStatus.INSTALLING_UPDATE__ *(3)* - The app had an optional or mandatory update that was successfully downloaded and is about to be installed.
* __CodePush.SyncStatus.UP_TO_DATE__ *(4)* - The app does not have an available update.
* __CodePush.SyncStatus.UPDATE_IGNORED__ *(5)* - The app has an optional update, that the user chose to ignore.
* __CodePush.SyncStatus.UPDATE_INSTALLED__ *(6)* - The update has been installed and will be run either immediately after the syncStatusCallback function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
* __CodePush.SyncStatus.UNKNOWN_ERROR__ *(-1)* - The sync operation encountered an unknown error.
* __downloadProgressCallback__ (function(progress: DownloadProgress)) - Called periodically when the update package is being downloaded from the CodePush server to report the progress of the update. `DownloadProgress` contains two fields:
* __totalBytes__ (Number) - The total number of bytes expected to be received for this update package
* __receivedBytes__ (Number) - The number of bytes downloaded thus far.
The method returns a `Promise` that is resolved to a `SyncStatus` integer code, which indicates why the `sync` call succeeded. This code can be one of the following values:
* __CodePush.SyncStatus.UP_TO_DATE__ *(0)* - The app doesn't have an available update.
* __CodePush.SyncStatus.UPDATE_IGNORED__ *(1)* - The app has an optional update, that the user chose to ignore.
* __CodePush.SyncStatus.UPDATE_APPLIED__ *(2)* - The app had an optional or mandatory update that was successfully downloaded and is about to be applied. If your app needs to do any data persistence/migration before restarting, this is the time to do it.
* __CodePush.SyncStatus.UP_TO_DATE__ *(4)* - The app does not have an available update.
* __CodePush.SyncStatus.UPDATE_IGNORED__ *(5)* - The app has an optional update, that the user chose to ignore.
* __CodePush.SyncStatus.UPDATE_INSTALLED__ *(6)* - The update has been installed and will be run either immediately after the syncStatusCallback function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.

@@ -223,5 +241,5 @@ If the update check and/or the subseqeuent download fails for any reason, the `Promise` object returned by `sync` will be rejected with the reason.

.then((status) => {
if (status == codePush.SyncStatus.UPDATE_APPLIED) {
if (status == codePush.SyncResult.UPDATE_INSTALLED) {
// Do any neccessary work here before the app
// is restarted in order to apply the update
// is restarted in order to install the update
}

@@ -240,3 +258,3 @@ })

* [LocalPackage](#localpackage): Represents a locally available package that either representing the currently running code or an update that hasn't been applied yet
* [LocalPackage](#localpackage): Represents a locally available package that either representing the currently running code or an update that hasn't been installed yet
* [RemotePackage](#remotepackage): Represents a remotely available package that provides an update to the app, and can be downloaded

@@ -246,3 +264,3 @@

Contains details about an update package that has been downloaded locally or already applied (currently installed package). You can get a reference to an instance of this object either by calling the module-level `getCurrentPackage` method, or as the value of the promise returned by the `download` method of a RemotePackage.
Contains details about an update package that has been downloaded locally or already installed (currently installed package). You can get a reference to an instance of this object either by calling the module-level `getCurrentPackage` method, or as the value of the promise returned by the `download` method of a RemotePackage.

@@ -253,3 +271,3 @@ ##### Properties

- __description__: Package description. (String) This is the same value that you specified in the CLI when you released the update
- __failedApply__: Indicates whether this package instance had been previously applied but was rolled back. (Boolean) The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`.
- __failedInstall__: Indicates whether this package instance had been previously installed but was rolled back. (Boolean) The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`.
- __label__: Package label. (String)

@@ -259,9 +277,10 @@ - __isMandatory__: Flag indicating if the update is mandatory. (Boolean) This is the value that you specified in the CLI when you released the update

- __packageSize__: The size of the package, in bytes. (Number)
- __isFirstRun__: Flag indicating whether this is the first time the package has been run after being applied. (Boolean) This is useful for determining whether you would like to show a "What's New?" UI to the end-user after applying an update.
- __isFirstRun__: Flag indicating whether this is the first time the package has been run after being installed. (Boolean) This is useful for determining whether you would like to show a "What's New?" UI to the end-user after installing an update.
##### Methods
- __apply(rollbackTimeout): Promise__: Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded.
If the rollbackTimeout parameter is provided, the application will wait for a `notifyApplicationReady` for the given number of milliseconds.
If `notifyApplicationReady` is called before the time period specified by rollbackTimeout, the apply operation is considered a success.
Otherwise, the apply operation will be marked as failed, and the application is reverted to its previous version.
- __install(rollbackTimeout: Number = 0, installMode: CodePush.InstallMode = CodePush.InstallMode.UPDATE_ON_RESTART): Promise&lt;void&gt;__: Installs this package to the application by unzipping its contents (e.g. the JS bundle) and saving it to the location on disk where the runtime expects to find the latest version of the app. If the `InstallMode` parameter is set to `UPDATE_ON_RESTART`, the install will complete, but it won't take effect until the next time that the app is restarted. If it is `UPDATE_ON_RESUME`, it will take effect when the app is next resumed after going into the background. If the parameter is set to `IMMEDIATE`, it will immediately restart after performing the install, so that the end-user sees the changes.
<br /><br />
If a value greater than zero is provided to the `rollbackTimeout` parameter, the application will wait for the `notifyApplicationReady` method to be called for the given number of milliseconds.
<br /><br />
Note: The "rollback timer" doesn't start until the update has actually become active. If the `installMode` is `IMMEDIATE`, then the rollback timer will also start immediately. However, if the `installMode` is `UPDATE_ON_RESTART` or `UPDATE_ON_RESUME`, then the rollback timer will start the next time the app starts or resumes, not at the point that you called `install`.

@@ -279,3 +298,3 @@ #### RemotePackage

##### Methods
- __download(): Promise<LocalPackage>__: Downloads the package update from the CodePush service. Returns a Promise that resolves with the `LocalPackage`.
- __download(downloadProgressCallback?: Function): Promise<LocalPackage>__: Downloads the package update from the CodePush service. If a `downloadProgressCallback` is specified, it will be called periodically with a `DownloadProgress` object (`{ totalBytes: Number, receivedBytes: Number }`) that reports the progress of the download until the download completes. Returns a Promise that resolves with the `LocalPackage`.

@@ -282,0 +301,0 @@ ---

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc