update-time from settings

master
Martin Zwigl 2025-03-08 16:13:31 +01:00
parent a5a38fa055
commit db61b51771
3 changed files with 15 additions and 6 deletions

View File

@ -2,9 +2,17 @@
Crypto-Coins Infos with the help of the Binance API
## Description
- Is a clock_info module and an app
- Updates prices with the free Binance API
- clkInfo updates after around 30 sec and then every x minutes (via settings) thereafter.
- The token you want to have tracked and compared to what currency have to be uploaded via app loader web-interface
- After that you can decide which token to display in settings
## Creator
Martin Zwigl
## Reminder for last working
- c3388b6434d2acc92f0c536a0ae9042f4fec0ced
## Reminder for last working state
- a5a38fa055e5cd671fe87d8253f4296c767d6d93

View File

@ -54,7 +54,7 @@
callback();
})
.catch(err => {
logFile.write("API Error: " + JSON.stringify(err));
// logFile.write("API Error: " + JSON.stringify(err));
cache[token] = {
text: "Error",
img: LOAD_ICON_24
@ -64,6 +64,7 @@
};
// Set timeout to align to the next hour and then continue updating every hour
const updateTime = settings.getRateMin * 60 * 1000;
// TODO get update time from settings
self.interval = setTimeout(function timerTimeout() {
fetchData(() => {
@ -74,8 +75,8 @@
fetchData(() => {
self.emit("redraw");
});
}, 3600000);
}, 60000 - (Date.now() % 60000 ));
}, updateTime);
}, 30000 - (Date.now() % 30000 ));
},
hide: function() {
if (this.interval) {

View File

@ -1,7 +1,7 @@
{ "id": "coin_info",
"name": "Crypto-Coins Info",
"shortName":"Coins Info",
"version": "0.05.04",
"version": "0.05.05",
"description": "Crypto-Coins Infos with the help of the Binance API",
"icon": "app.png",
"tags": "clkinfo",