function watchAndReload() {
  if (window.location.pathname === '/') {
    const TIMEOUT = 10000;
    function reload() {
      const req = new XMLHttpRequest();
      req.open('GET', window.location);
      req.onreadystatechange = function() {
        if (req.readyState === 4) {
          if (req.status === 200) {
            window.location.reload();
          }
          else {
            setTimeout(reload, TIMEOUT);
          }
        }
      }
      req.timeout = TIMEOUT;
      try {
        req.send(null);
      }
      catch (_) {
      }
    }
    setTimeout(reload, TIMEOUT);
  }
}
// If the window disconnects from the server, poll until it comes back and reload
If the window disconnects from the server, poll until it comes back and reload
If the window disconnects from the server poll until it comes back and reload
function watchAndReload() {
  if (window.location.pathname === '/') {
    const TIMEOUT = 10000;
    function reload() {
      const req = new XMLHttpRequest();
      req.open('GET', window.location);
      req.onreadystatechange = function() {
        if (req.readyState === 4) {
          if (req.status === 200) {
            window.location.reload();
          }
          else {
            setTimeout(reload, TIMEOUT);
          }
        }
      }
      req.timeout = TIMEOUT;
      try {
        req.send(null);
      }
      catch (_) {
      }
    }
    setTimeout(reload, TIMEOUT);
  }
}
function watchAndReload ( ) { if ( window . location . pathname === '/' ) { const TIMEOUT = 10000 ; function reload ( ) { const req = new XMLHttpRequest ( ) ; req . open ( 'GET' , window . location ) ; req . onreadystatechange = function ( ) { if ( req . readyState === 4 ) { if ( req . status === 200 ) { window . location . reload ( ) ; } else { setTimeout ( reload , TIMEOUT ) ; } } } req . timeout = TIMEOUT ; try { req . send ( null ) ; } catch ( _ ) { } } setTimeout ( reload , TIMEOUT ) ; } }
If the window disconnects from the server, poll until it comes back and reload
If the window disconnects from the server poll until it comes back and reload