Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit fda4963

Browse files
committed
Updating restartApp doc
1 parent 464dae1 commit fda4963

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,15 @@ If you are using the `sync` function, and doing your update check on app start,
336336
#### codePush.restartApp
337337
338338
```javascript
339-
codePush.restartApp(): void;
339+
codePush.restartApp(onlyIfUpdateIsPending: Boolean = false): void;
340340
```
341341
342-
Immediately restarts the app. If there is an update pending, it will be presented to the end user and the rollback timer (if specified when installing the update) will begin. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process. This method is for advanced scenarios, and is primarily useful when the following conditions are true:
342+
Immediately restarts the app. If there is an update pending, it will be presented to the end user and the rollback timer (if specified when installing the update) will begin. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process. If a truthy value is passed to the `onlyIfUpdateIsPending` parameter, then the app will only be restarted if there is actually a pending update waiting to be applied. Otherwise, this method call will no-op.
343+
344+
This method is for advanced scenarios, and is primarily useful when the following conditions are true:
343345

344-
1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS) or resumed, and therefore, the update won't be immediately displayed to the end user .
346+
1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS) or resumed, and therefore, the update won't be immediately displayed to the end user.
347+
345348
2. You have an app-specific user event (e.g. the end user navigated back to the app's home route) that allows you to apply the update in an unobtrusive way, and potentially gets the update in front of the end user sooner then waiting until the next restart or resume.
346349

347350
#### codePush.sync

0 commit comments

Comments
 (0)