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) { if (!req.responseText) {
return; return;
} }
var ver = req.responseText.trim();
if (!currentVersion) { if (!currentVersion) {
currentVersion = req.responseText.trim(); currentVersion = ver;
} }
if (req.responseText !== latestVersion) { if (ver !== latestVersion) {
latestVersion = req.responseText.trim(); latestVersion = ver;
if (module.exports.hasNewVersion()) { if (module.exports.hasNewVersion()) {
console.log("Current=%s Latest=%s", currentVersion, latestVersion); console.log("Current=%s Latest=%s", currentVersion, latestVersion);
listener(currentVersion, latestVersion); listener(currentVersion, latestVersion);