Split out response text to its own var to prevent trim() messing up comparisons

This commit is contained in:
Kegan Dougal 2016-02-03 16:23:17 +00:00
parent 5eed734325
commit 4628cf82a7

View File

@ -29,12 +29,13 @@ module.exports = {
if (!req.responseText) {
return;
}
var ver = req.responseText.trim();
if (!currentVersion) {
currentVersion = req.responseText.trim();
currentVersion = ver;
}
if (req.responseText !== latestVersion) {
latestVersion = req.responseText.trim();
if (ver !== latestVersion) {
latestVersion = ver;
if (module.exports.hasNewVersion()) {
console.log("Current=%s Latest=%s", currentVersion, latestVersion);
listener(currentVersion, latestVersion);