determine, when your electron app is online or went offline.
const ElectronOnline = require('electron-online')
const connection = new ElectronOnline()
connection.on('online', () => {
console.log('App is online!')
})
connection.on('offline', () => {
console.log('App is offline!')
})
console.log(connection.status) // 'PENDING'
$ npm i electron-online
connection
is an EventEmitter
instance.
a string that represents the status of the app's connection. can be PENDING
(when still determining the initial status), ONLINE
, or OFFLINE
.
fires, when the app comes online.
fires, when the app becomes offline.
$ npm test