Is Where A Way To Listen To Wireless Network Changes In Node Js?
I am building an application in which I need to detect the any changes in connected wireless network ie when a user transfers from one network to another and log the change. I am u
Solution 1:
online (in index.html or in other html file) to detect if an internet connection exist like this :
In index.html you can do this :
const {ipcRenderer} = require('electron');
const updateOnlineStatus = () => {
ipcRenderer.send('online-status-changed', navigator.onLine ? true : false)
}
window.addEventListener('online', updateOnlineStatus)
window.addEventListener('offline', updateOnlineStatus)
and in your file main.js :
var ipcMain = require('electron').ipcMain;
ipcMain.on('online-status-changed', (event, status) => {
if(status)
alert("you are online");
else
alert("you are offline");}
Post a Comment for "Is Where A Way To Listen To Wireless Network Changes In Node Js?"