mirror of
https://github.com/seigler/Dash-price-widget
synced 2025-07-27 08:06:09 +00:00
added five minute refresh interval
This commit is contained in:
parent
2965e90656
commit
94da47ae9d
2 changed files with 36 additions and 26 deletions
|
@ -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
7
dist/index.html
vendored
|
@ -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>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue