Skip to content

Instantly share code, notes, and snippets.

@nolimits4web
Last active October 4, 2019 11:47
Show Gist options
  • Save nolimits4web/527ceddaf117325e8be3ee2e91f6bdca to your computer and use it in GitHub Desktop.
Save nolimits4web/527ceddaf117325e8be3ee2e91f6bdca to your computer and use it in GitHub Desktop.
const app = new Framework7(/*...*/);
if (app.online) {
console.log('online!');
}
if (!app.online) {
console.log('offline!');
}
app.on('online', () => {
console.log('connection established')
});
app.on('offline', () => {
console.log('lost connection')
});
// or with single event
app.on('connection', (isOnline) => {
if (isOnline) {
console.log('connection established')
} else {
console.log('lost connection')
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment