Last active
July 24, 2021 13:41
-
-
Save Max-Hutschenreiter/8bf91f0be955574b21168e81c03592e2 to your computer and use it in GitHub Desktop.
Scriptable to show how long its taking for Germany to get herd immunity from Corona
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const apiUrl = 'https://impf-statistik.de/api/countdown'; | |
let widget = await createWidget(); | |
Script.setWidget(widget); | |
Script.complete(); | |
async function createWidget(itens){ | |
const list = new ListWidget(); | |
let header, label; | |
const data = await getCountdown(); | |
header = list.addText("🦠 Corona Herdenimmunität"); | |
header.font = Font.mediumSystemFont(14); | |
label = list.addText("in "+data.numberOfDays+" Tagen am "+data.date+""); | |
label.font = Font.mediumSystemFont(16); | |
website = list.addText("https://impf-statistik.de"); | |
website.font = Font.mediumSystemFont(9); | |
async function getCountdown(){ | |
let data = await new Request(apiUrl).loadJSON(); | |
return data; | |
} | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Max, bezüglich dem Hinweis auf Deiner Website:
Wie kann ich die Konfiguration über die API verwenden? Mein Widget zeigt mir zuversichtlich an, dass die Herdenimmunität seit vier Tagen erreicht sei; dem ist ja leider so nicht :-(
Danke für Deine Arbeit!!!