structural modifications for getting data
parent
fd58e6273b
commit
b68684f34d
|
|
@ -14,13 +14,13 @@ var tknChrtData = [5,6,5,6,5,6,5,6,5,6,5,6,5,6,];
|
||||||
//
|
//
|
||||||
Bangle.loadWidgets(); // loading widgets after drawing the layout in `drawMain()` to display the app UI ASAP.
|
Bangle.loadWidgets(); // loading widgets after drawing the layout in `drawMain()` to display the app UI ASAP.
|
||||||
require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe
|
require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe
|
||||||
Bangle.setUI({
|
// Bangle.setUI({
|
||||||
mode: 'custom',
|
// mode: 'custom',
|
||||||
back: Bangle.showClock
|
// back: Bangle.showClock
|
||||||
// btn: function() { // Handle button press
|
// // btn: function() { // Handle button press
|
||||||
// console.log("Button pressed");
|
// // console.log("Button pressed");
|
||||||
// }
|
// // }
|
||||||
});
|
// });
|
||||||
//
|
//
|
||||||
function swipeHandler(lr, ud) {
|
function swipeHandler(lr, ud) {
|
||||||
if (lr == 1) {
|
if (lr == 1) {
|
||||||
|
|
@ -74,7 +74,10 @@ layout.update();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
function getChart() {
|
function getChart(period) {
|
||||||
|
timePeriod = period;
|
||||||
|
currLoadMsg = `Load... ${period}`;
|
||||||
|
|
||||||
const url = `https://openapiv1.coinstats.app/coins/${csTokens[ticker]}/charts?period=${timePeriod}`;
|
const url = `https://openapiv1.coinstats.app/coins/${csTokens[ticker]}/charts?period=${timePeriod}`;
|
||||||
Bangle
|
Bangle
|
||||||
.http(url, {
|
.http(url, {
|
||||||
|
|
@ -96,10 +99,11 @@ function getChart() {
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// logFile.write("API Error: " + JSON.stringify(err));
|
// logFile.write("API Error: " + JSON.stringify(err));
|
||||||
|
tknChrtData = [1,2,3,4,5,6,7,8,9,8,7,6,5,4,];
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// Schedule next update regardless of success or failure
|
// Schedule next update regardless of success or failure
|
||||||
updateTimeout = setTimeout(getChart, 300000); // 5 minutes
|
updateTimeout = setTimeout(getChart, 60000, period); // 5 minutes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,4 +139,4 @@ function draw() {
|
||||||
// update time and draw
|
// update time and draw
|
||||||
g.clear();
|
g.clear();
|
||||||
draw();
|
draw();
|
||||||
getChart();
|
getChart("24h");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "coin_info",
|
{ "id": "coin_info",
|
||||||
"name": "Crypto-Coins Info",
|
"name": "Crypto-Coins Info",
|
||||||
"shortName":"Coins Info",
|
"shortName":"Coins Info",
|
||||||
"version": "0.06.45",
|
"version": "0.06.46",
|
||||||
"description": "Crypto-Coins Infos with the help of the Binance API",
|
"description": "Crypto-Coins Infos with the help of the Binance API",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "clkinfo",
|
"tags": "clkinfo",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue