This commit is contained in:
Pupil
2020-02-04 14:47:54 +09:00
parent b7c6735975
commit 95922b1fce
5 changed files with 63 additions and 10 deletions

22
assets/js/pupil.js Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
const LATEST_URL = "https://api.github.com/repos/tom5079/Pupil/releases/latest";
function getLatestRelease() {
return new Promise(function(resolve, reject) {
const xhr = new XMLHttpRequest();
xhr.open("GET", LATEST_URL)
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
resolve(JSON.parse(xhr.responseText))
} else {
reject(new Error('XHR failed on getLAtestRelease() with status ' + xhr.status))
}
}
};
xhr.send();
})
}