Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created March 18, 2016 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/8ff51943f3f62441fffe to your computer and use it in GitHub Desktop.
Save peterbe/8ff51943f3f62441fffe to your computer and use it in GitHub Desktop.
$(function () {
var currentEventStatus = $('.entry-content').data('event-status');
function checkStatus() {
$.get(location.pathname + 'status/')
.then(function (data) {
if (currentEventStatus !== data.status) {
location.reload();
}
});
};
var interval = setInterval(function () {
checkStatus()
.fail(function () {
console.warn("Failed to fetch event status. Stops looking.");
clearInterval(interval);
});
}, 10 * 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment