Invoke onVersion when we know the current version even if there is no new version (for settings)

pull/856/head
Kegan Dougal 2016-02-03 16:50:05 +00:00
parent 4628cf82a7
commit b307a6d64e
2 changed files with 5 additions and 4 deletions

View File

@ -106,8 +106,8 @@ function onHashChange(ev) {
routeUrl(window.location); routeUrl(window.location);
} }
function onNewVersion(current, latest) { function onVersion(current, latest) {
window.matrixChat.onNewVersion(current, latest); window.matrixChat.onVersion(current, latest);
} }
var loaded = false; var loaded = false;
@ -143,7 +143,7 @@ window.onload = function() {
if (!validBrowser) { if (!validBrowser) {
return; return;
} }
UpdateChecker.setNewVersionListener(onNewVersion); UpdateChecker.setVersionListener(onVersion);
UpdateChecker.run(); UpdateChecker.run();
routeUrl(window.location); routeUrl(window.location);
loaded = true; loaded = true;

View File

@ -19,7 +19,7 @@ var latestVersion = null;
var listener = function(){}; // NOP var listener = function(){}; // NOP
module.exports = { module.exports = {
setNewVersionListener: function(fn) { // invoked with fn(currentVer, newVer) setVersionListener: function(fn) { // invoked with fn(currentVer, newVer)
listener = fn; listener = fn;
}, },
@ -32,6 +32,7 @@ module.exports = {
var ver = req.responseText.trim(); var ver = req.responseText.trim();
if (!currentVersion) { if (!currentVersion) {
currentVersion = ver; currentVersion = ver;
listener(currentVersion, currentVersion);
} }
if (ver !== latestVersion) { if (ver !== latestVersion) {