Skip to content

Commit

Permalink
Add callbacks for statusDidChange and downloadDidProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperka committed Sep 6, 2016
1 parent 57cc85d commit 1d04a02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ yield spawn(codePushSaga, {
yield spawn(codePushSaga, {
syncActionName: "NAVIGATE_HOME"
});
```
// Invoke a callback every time the sync status changes
// or show a status bar as the download progresses.
// You can find a list of status types at
// https://github.com/Microsoft/react-native-code-push#syncstatus.
yield spawn(codePushSaga, {
statusDidChangeCallback: this.onSyncStatusChange,
downloadDidProgressCallback: this.onSyncDownloadProgress,
});
```
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function* codePushSaga(options = {}) {
// off the "event loop".
if (options.syncOnStart) {
try {
yield call(sync, options.syncOptions);
yield call(sync, options.syncOptions, options.statusDidChangeCallback, options.downloadDidProgressCallback);
} catch (e) {
console.log(e);
}
Expand All @@ -107,7 +107,7 @@ export default function* codePushSaga(options = {}) {
// to watch for any of the requested sync points.
while (yield race(syncEvents)) {
try {
yield call(sync, options.syncOptions);
yield call(sync, options.syncOptions, options.statusDidChangeCallback, options.downloadDidProgressCallback);
} catch (e) {
console.log(e);
}
Expand Down

0 comments on commit 1d04a02

Please sign in to comment.