Add covid tracking script
This commit is contained in:
15
covid-widget.lua
Normal file
15
covid-widget.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
function onAlarm()
|
||||||
|
net:getText("https://api.covid19api.com/summary")
|
||||||
|
end
|
||||||
|
|
||||||
|
function onNetworkResult(result)
|
||||||
|
local new = json:getValue(result, "object object:Global int:NewConfirmed")
|
||||||
|
local total = json:getValue(result, "object object:Global int:TotalConfirmed")
|
||||||
|
local newDeaths = json:getValue(result, "object object:Global int:NewDeaths")
|
||||||
|
local totalDeaths = json:getValue(result, "object object:Global int:TotalDeaths")
|
||||||
|
|
||||||
|
ui:showLines({
|
||||||
|
"Disease: total = "..total.." new = "..new,
|
||||||
|
"Deaths: total = "..totalDeaths.." new = "..newDeaths
|
||||||
|
})
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user