async function isConnected() {
  try {
    const lookupService = util.promisify(dns.lookupService);
    const result = await lookupService('8.8.8.8', 53);
    return true;
  } catch (err) {
    return false;
  }
}
Uses Puppeteer and the browser's online/offline events to monitor internet
connection status.