mapcomplete/test.ts

23 lines
740 B
TypeScript
Raw Normal View History

2020-10-03 23:04:46 +00:00
//*
2020-10-09 19:11:52 +00:00
2020-10-11 23:25:27 +00:00
import LiveQueryHandler from "./Logic/Web/LiveQueryHandler";
import {VariableUiElement} from "./UI/Base/VariableUIElement";
2020-10-09 19:11:52 +00:00
2020-10-11 23:25:27 +00: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-05 23:37:02 +00:00
/*/
import {Utils} from "./Utils";
import {FixedUiElement} from "./UI/Base/FixedUiElement";
Utils.generateStats((stats) => {
2020-10-05 23:37:02 +00:00
new FixedUiElement(stats).AttachTo('maindiv')
})
//*/