status converted to module

This commit is contained in:
azivner 2017-11-04 19:35:39 -04:00
parent ad7803f9dc
commit 60a3abdea9
2 changed files with 41 additions and 34 deletions

View File

@ -1,4 +1,6 @@
const status = (function() {
const treeEl = $("#tree");
const $changesToPushCountEl = $("#changesToPushCount");
async function checkStatus() {
const resp = await $.ajax({
@ -34,7 +36,12 @@ async function checkStatus() {
encryption.decryptTreeItems();
}
$("#changesToPushCount").html(resp.changesToPushCount);
$changesToPushCountEl.html(resp.changesToPushCount);
}
setInterval(checkStatus, 5 * 1000);
return {
checkStatus
};
})();

View File

@ -4,7 +4,7 @@ function syncNow() {
type: 'POST',
success: result => {
if (result.success) {
checkStatus();
status.checkStatus();
message("Sync triggered.");
}