Skip to content

Commit

Permalink
Improve setOnline example
Browse files Browse the repository at this point in the history
  • Loading branch information
superguineapig committed Dec 13, 2018
1 parent a3cbd37 commit 485e017
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,13 @@ const config = {

const clock = new clockSync(config);

// this handler will receive the device's network status
function handleConnectivityChange = isConnected => {
// set initial state
NetInfo.isConnected.fetch().then(isConnected => {
clock.setOnline(isConnected);
});

// this handler will receive the device's network status changes
function handleConnectivityChange (isConnected) {
clock.setOnline(isConnected);
}

Expand Down

0 comments on commit 485e017

Please sign in to comment.