rateLimitedAsyncPoolmain.tsx2 matches
1import { asyncPool } from "https://esm.town/v/harryhood/asyncPool";
23// A generic utility function that handles concurrency and rate-limiting
4export async function rateLimitedAsyncPool<T, V>(
5items: T[],
6poolLimit: number,
rateLimitedAsyncPoolREADME.md2 matches
1## Summary
23This function allows you to run a rate limited async pool to make sure no more than `poolLimit` items at a time are run for a given `waitTime`.
45## Example Usage
67```
8async function fetchURL(url: string): Promise<string[]> {
9const response = await fetch(url);
10const html = await response.text();
3Async Pool: Promise.all for Bulk Operations. Taken from [this article](https://maxgreenwald.me/blog/async-pool-promise.all-for-bulk-operations).
45`asyncPool` is a utility with the same functionality as `Promise.all` + `Array.map` that keeps the number of concurrent executions at or below a set number.
67Migrated from folder: lib/async/asyncPool
1import { valTownButtonClicks } from "https://esm.town/v/petermillspaugh/valTownButtonClicks";
23export async function getValTownButtonClicks(request: Request): Promise<Response> {
4return Response.json({ valTownButtonClicks });
5}
2import { set } from "https://esm.town/v/std/set?v=14";
34export async function setValTownButtonClicks(request: Request): Promise<Response> {
5if (request.method !== "POST") return Response.json({ valTownButtonClicks });
6
emailSubscriptionREADME.md2 matches
21const [email, setEmail] = useState("");
2223async function handleSubmit(e) {
24e.preventDefault();
25setName("");
7576useEffect(() => {
77async function confirmEmail() {
78if (!email || !token) return;
79
2import { html } from "https://esm.town/v/stevekrouse/html?v=5";
34export async function readme(request: Request): Promise<Response> {
5const url = new URL(request.url);
6const [, , author, name] = url.pathname.split("/");
oldfashionedmain.tsx9 matches
23const { styleRoute, StyleTag } = styleSystem();
2425function MaterialsList() {
26const c = useContext(RequestContext);
27const mats = getMaterialIds(c);
76}
7778function RecipesList() {
79const c = useContext(RequestContext);
80const s = c?.req.param("slug");
131} as const;
132133function Units() {
134const requestContext = useContext(RequestContext);
135let unit = getCookie(requestContext!, "units") || "";
162});
163164function getTitle(recipe: Recipe | undefined): string {
165if (!recipe) {
166return "Old Fashioned";
169}
170171function parseUnit(unit: string | undefined): Fmt {
172if (unit === "CL" || unit === "Ml" || unit === "Oz") {
173return unit;
176}
177178function WelcomeMessage() {
179return (
180<plank id="recipe-detail" hx-swap-oob="true">
203}
204205function RecipeDetail() {
206const c = useContext(RequestContext);
207const s = c?.req.param("slug") || "";
257}
258259function IngredientDisplay({ ingredient, unit }: {
260ingredient: Ingredient;
261unit: keyof typeof units;
292}
293294function Index() {
295const requestContext = useContext(RequestContext);
296const s = requestContext?.req.param("slug") || "";
styleSystemmain.tsx2 matches
3import { Context } from "npm:hono@3.8.1";
45export function styleSystem() {
6function StyleTag() {
7return (
8<style