added five minute refresh interval

This commit is contained in:
Joshua Seigler 2016-04-29 00:35:04 -04:00
parent 2965e90656
commit 94da47ae9d
2 changed files with 36 additions and 26 deletions

View file

@ -15,7 +15,8 @@
httpRequest.send(); httpRequest.send();
} }
// this requests the file and executes a callback with the parsed result once it is available function updatePrices() {
// this requests the Dash price JSON and executes a callback with the parsed result once it is available
fetchJSONFile('https://coinmarketcap-nexuist.rhcloud.com/api/dash/price', function (data) { fetchJSONFile('https://coinmarketcap-nexuist.rhcloud.com/api/dash/price', function (data) {
var keys = Object.keys(data), var keys = Object.keys(data),
currencyListHTML = ""; currencyListHTML = "";
@ -28,4 +29,8 @@
} }
document.getElementById('dash-ticker--price-container').innerHTML = currencyListHTML; document.getElementById('dash-ticker--price-container').innerHTML = currencyListHTML;
}); });
}
updatePrices(); // update prices now
setInterval(updatePrices, 5 * 60 * 1000); // ...and every five minutes after this
})(); })();

7
dist/index.html vendored
View file

@ -86,7 +86,8 @@
httpRequest.send(); httpRequest.send();
} }
// this requests the file and executes a callback with the parsed result once it is available function updatePrices() {
// this requests the Dash price JSON and executes a callback with the parsed result once it is available
fetchJSONFile('https://coinmarketcap-nexuist.rhcloud.com/api/dash/price', function (data) { fetchJSONFile('https://coinmarketcap-nexuist.rhcloud.com/api/dash/price', function (data) {
var keys = Object.keys(data), var keys = Object.keys(data),
currencyListHTML = ""; currencyListHTML = "";
@ -99,5 +100,9 @@
} }
document.getElementById('dash-ticker--price-container').innerHTML = currencyListHTML; document.getElementById('dash-ticker--price-container').innerHTML = currencyListHTML;
}); });
}
updatePrices(); // update prices now
setInterval(updatePrices, 5 * 60 * 1000); // ...and every five minutes after this
})(); })();
</script> </script>