mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
move version checking code into its own folder and file
This commit is contained in:
31
js/version/version.js
Normal file
31
js/version/version.js
Normal file
@@ -0,0 +1,31 @@
|
||||
var version = {
|
||||
updateInterval: 3000,
|
||||
intervalId: null
|
||||
}
|
||||
|
||||
version.checkVersion = function () {
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'githash.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;
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
version.init = function () {
|
||||
|
||||
this.intervalId = setInterval(function () {
|
||||
this.checkVersion();
|
||||
}.bind(this), this.updateInterval);
|
||||
|
||||
}
|
Reference in New Issue
Block a user