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";
/*
# Email alerts when air is unhealthy near you */
export async function aqi() {
const location = "alamo square, sf"; // **<-- change to place, city, or zip code**
const data = await easyAQI({ location });
if (data.severity.includes("Unhealthy")) {
console.email(
"Air Quality: " + data.severity,
`AQI in ${location} is ${data.aqi}`
);
}
}
/* This val uses nominatim's geocoder to get your lat, lon,
and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. This val was
created with much help from @russbiggs (Director of
Technology at OpenAQ) */
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