Skip to content

Commit e640ed0

Browse files
authored
Remove readyState check
Quite why i added it i don't known
1 parent 91c325d commit e640ed0

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

js/helpinject.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,26 @@
5151
// We want the lastest release (doesn't include draft or preview releases)
5252
xhr.open('GET', 'https://api.github.com/repos/mu-editor/mu/releases/latest');
5353
xhr.onload = function() {
54-
// The request compleated
55-
if (xhr.readyState == 4) {
56-
// We got the data
57-
if (xhr.status === 200) {
58-
var lastest = {};
59-
try {
60-
// IE6 & IE7 support is superfluous
61-
lastest = JSON.parse(xhr.responseText);
62-
} catch (e) {
63-
console.error('Unable to parse release information', e);
64-
}
65-
if (typeof lastest.tag_name !== "undefined") {
66-
// Drop the 'v' from the start of the tag name
67-
var version = lastest.tag_name.substr(0, 1) == 'v' ? lastest.tag_name.substr(1) : lastest.tag_name;
68-
// Run the callback
69-
cb(semverRegex().test(version) ? semverRegex().exec(version)[0] : null);
70-
} else {
71-
console.error('GitHub did not return the expected data');
72-
}
54+
// We got the data
55+
if (xhr.status === 200) {
56+
var lastest = {};
57+
try {
58+
// IE6 & IE7 support is superfluous
59+
lastest = JSON.parse(xhr.responseText);
60+
} catch (e) {
61+
console.error('Unable to parse release information', e);
62+
}
63+
if (typeof lastest.tag_name !== "undefined") {
64+
// Drop the 'v' from the start of the tag name
65+
var version = lastest.tag_name.substr(0, 1) == 'v' ? lastest.tag_name.substr(1) : lastest.tag_name;
66+
// Run the callback
67+
cb(semverRegex().test(version) ? semverRegex().exec(version)[0] : null);
7368
} else {
74-
// Something went wrong. Fail quietly
75-
console.error('Unable to fetch release information');
69+
console.error('GitHub did not return the expected data');
7670
}
71+
} else {
72+
// Something went wrong. Fail quietly
73+
console.error('Unable to fetch release information');
7774
}
7875
};
7976
// Unable to fetch (Blocked by filter, CORs or network error)

0 commit comments

Comments
 (0)