(function (){ var wait_for_update = function() { console.debug("Waiting for changes..."); fetch('/__wait_for_changes').then(r => { if (r.status !== 200) { setTimeout( wait_for_update, 1000, ); } else { // Reload window.location = window.location; } }); }; wait_for_update(); })();