Skip to content

Commit cfa437b

Browse files
author
Richard Hua
authored
Use the function wrapper format instead of the decorator format for API examples
1 parent 82f0f41 commit cfa437b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -735,16 +735,16 @@ This decorator provides support for letting you customize its behaviour to easil
735735
// Fully silent update which keeps the app in
736736
// sync with the server, without ever
737737
// interrupting the end user
738-
@codePush()
739738
class MyApp extends Component {}
739+
codePush()(MyApp);
740740
```
741741
742742
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".
743743
744744
```javascript
745745
// Sync for updates everytime the app resumes.
746-
@codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })
747746
class MyApp extends Component {}
747+
codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp);
748748
```
749749
750750
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,16 +753,15 @@ This decorator provides support for letting you customize its behaviour to easil
753753
// Active update, which lets the end user know
754754
// about each update, and displays it to them
755755
// immediately after downloading it
756-
@codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })
757756
class MyApp extends Component {}
757+
codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp);
758758
```
759759
760760
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.
761761
762762
```javascript
763763
// Make use of the event hooks to keep track of
764764
// the different stages of the sync process.
765-
@codePush()
766765
class MyApp extends Component {
767766
codePushStatusDidChange(status) {
768767
switch(syncStatus) {
@@ -788,6 +787,7 @@ This decorator provides support for letting you customize its behaviour to easil
788787
console.log(progess.receivedBytes + " of " + progress.totalBytes + " received.");
789788
}
790789
}
790+
codePush()(MyApp);
791791
```
792792
793793
##### CodePushOptions

0 commit comments

Comments
 (0)