rats-search/src/background/checkInternet.js
Alexey Kasyanchuk fd4ba2c392 fix eslint
2018-06-18 00:06:28 +03:00

10 lines
275 B
JavaScript

// https://stackoverflow.com/questions/15270902/check-for-internet-connectivity-in-nodejs
module.exports = function checkInternet(cb) {
require('dns').lookup('google.com',function(err) {
if (err && err.code == "ENOTFOUND") {
cb(false);
} else {
cb(true);
}
})
}