Public
Script
Forked from stevekrouse/aqi
October 23, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=3";
export async function airquality(interval: Interval) {
const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
if (!interval.lastRunAt) {
console.email(
`You will now get Air Quality alerts for ${location} if it's unhealthy. It is now ${data.aqi} which is ${data.severity}.`,
`AQI Alerts for ${location} setup!`,
);
}
if (data.severity.includes("Unhealthy")) {
console.email(
"Air Quality: " + data.severity,
`AQI in ${location} is ${data.aqi}`,
);
}
}
// Forked from @stevekrouse.aqi
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023