Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scriptable to show how long its taking for Germany to get herd immunity from Corona
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