MagicMirror/js/version/version.js

29 lines
583 B
JavaScript
Raw Normal View History

var version = {
2015-10-19 01:30:24 -04:00
updateInterval: 600000,
intervalId: null
}
2015-10-23 17:02:15 -04:00
/**
* Checks the version and refreshes the page if a new version has been pulled
*/
version.checkVersion = function () {
$.getJSON('controllers/hash.php')
.success(function(data) {
// The githash variable is located in index.php
if (data && data.gitHash !== gitHash) {
window.location.reload();
window.location.href = window.location.href;
}
});
}
version.init = function () {
this.intervalId = setInterval(function () {
this.checkVersion();
}.bind(this), this.updateInterval);
2016-01-07 15:34:45 -05:00
}