mapcomplete/test.ts

23 lines
740 B
TypeScript
Raw Normal View History

2020-10-04 01:04:46 +02:00
//*
2020-10-09 21:11:52 +02:00
2020-10-12 01:25:27 +02:00
import LiveQueryHandler from "./Logic/Web/LiveQueryHandler";
import {VariableUiElement} from "./UI/Base/VariableUIElement";
2020-10-09 21:11:52 +02:00
2020-10-12 01:25:27 +02:00
const source = LiveQueryHandler.FetchLiveData("https://data.mobility.brussels/bike/api/counts/?request=live&featureID=CJM90",
"hour:data.hour_cnt;day:data.day_cnt;year:data.year_cnt".split(";"))
source.addCallback((data) => {console.log(data)})
new VariableUiElement(source.map(data => {
return ["Data is:", data.hour, "last hour;", data.day, "last day; ", data.year, "last year;"].join(" ")
})).AttachTo('maindiv')
2020-10-06 01:37:02 +02:00
/*/
import {Utils} from "./Utils";
import {FixedUiElement} from "./UI/Base/FixedUiElement";
Utils.generateStats((stats) => {
2020-10-06 01:37:02 +02:00
new FixedUiElement(stats).AttachTo('maindiv')
})
//*/