Created
March 18, 2016 17:45
-
-
Save peterbe/8ff51943f3f62441fffe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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