mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
Use the function wrapper format instead of the decorator format for API examples
This commit is contained in:
@@ -735,16 +735,16 @@ This decorator provides support for letting you customize its behaviour to easil
|
||||
// Fully silent update which keeps the app in
|
||||
// sync with the server, without ever
|
||||
// interrupting the end user
|
||||
@codePush()
|
||||
class MyApp extends Component {}
|
||||
codePush()(MyApp);
|
||||
```
|
||||
|
||||
2. **Silent sync everytime the app resumes**. Same as 1, except we check for updates, or apply an update if one exists every time the app returns to the foreground after being "backgrounded".
|
||||
|
||||
```javascript
|
||||
// Sync for updates everytime the app resumes.
|
||||
@codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })
|
||||
class MyApp extends Component {}
|
||||
codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp);
|
||||
```
|
||||
|
||||
3. **Interactive**. When an update is available, prompt the end user for permission before downloading it, and then immediately apply the update. If an update was released using the `mandatory` flag, the end user would still be notified about the update, but they wouldn't have the choice to ignore it.
|
||||
@@ -753,8 +753,8 @@ This decorator provides support for letting you customize its behaviour to easil
|
||||
// Active update, which lets the end user know
|
||||
// about each update, and displays it to them
|
||||
// immediately after downloading it
|
||||
@codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })
|
||||
class MyApp extends Component {}
|
||||
codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp);
|
||||
```
|
||||
|
||||
4. **Log/display progress**. While the app is syncing with the server for updates, make use of the `codePushStatusDidChange` and/or `codePushDownloadDidProgress` event hooks to log down the different stages of this process, or even display a progress bar to the user.
|
||||
@@ -762,7 +762,6 @@ This decorator provides support for letting you customize its behaviour to easil
|
||||
```javascript
|
||||
// Make use of the event hooks to keep track of
|
||||
// the different stages of the sync process.
|
||||
@codePush()
|
||||
class MyApp extends Component {
|
||||
codePushStatusDidChange(status) {
|
||||
switch(syncStatus) {
|
||||
@@ -788,6 +787,7 @@ This decorator provides support for letting you customize its behaviour to easil
|
||||
console.log(progess.receivedBytes + " of " + progress.totalBytes + " received.");
|
||||
}
|
||||
}
|
||||
codePush()(MyApp);
|
||||
```
|
||||
|
||||
##### CodePushOptions
|
||||
|
||||
Reference in New Issue
Block a user