Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Burl%7D?q=fetch&page=780&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8212 results for "fetch"(3170ms)

htmxTimedmain.tsx1 match

@neverstew•Updated 1 year ago
41 <li><p>New item</p></li>
42 `));
43 const response = await app.fetch(request);
44 const afterResponse = performance.now() - afterHono;
45 console.log("after response", afterResponse);

deleteValmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export function deleteVal({ token, id }: {
5 id: string;
6}): Promise<Response> {
7 return fetch("https://api.val.town/v1/vals/" + id, {
8 headers: {
9 Authorization: `Bearer ${token}`,

kbrmain.tsx3 matches

@bert•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const kbr = async () => {
5 const itemId = "B/9/9/1/2/4/2/1/0000-00-00_00";
6 const imageId = "BE-KBR00_B-19912421_0000-00-00_00_0001";
7 const fetchText = (url) => fetch(url).then((response) => response.text());
8 const url = `${baseUrl}/${itemId}/${imageId}.txt`;
9 const dimensions = await fetchText(url);
10 return dimensions.split("x").map((c) => Number(c));
11};

fetchJSONmain.tsx4 matches

@mgruel•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchJSON = <T extends any = any>(
4 url: string | URL,
5 options?: RequestInit,
6): Promise<T> =>
7 fetch(url, {
8 redirect: "follow",
9 ...options,
10 }).then((r) => r.json() as T);
11// Forked from @stevekrouse.fetchJSON

measureValTownE2emain.tsx3 matches

@healeycodes•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// E.g. from a user's perspective (not the real execution time!)
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }

forceUnsubmain.tsx2 matches

@mihir•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import { getGoogleAccessTokenFromRefreshToken } from "https://esm.town/v/mihir/getGoogleAccessTokenFromRefreshToken";
3
8 const from = emails.join(" OR ");
9
10 return fetchJSON(
11 "https://gmail.googleapis.com/gmail/v1/users/me/settings/filters",
12 {

boredActivitiesmain.tsx2 matches

@andreterron•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON('https://www.boredapi.com/api/activity')

fetchTimelinemain.tsx3 matches

@dpetrouk•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchTimeline(url, options) {
4 // const tweetId = url.match(/\/(\d*)\?+/)[1];
5 // const tweetUrl =
6 // `https://cdn.syndication.twimg.com/tweet-result?id=${tweetId}&lang=en`;
7 // return { url, tweetId, tweetUrl };
8 const res = await fetch(
9 "https://syndication.twimg.com/srv/timeline-profile/screen-name/patttten",
10 // "https://cdn.syndication.twimg.com/timeline/profile?screen_name=patttten",

LoginPelotonmain.tsx2 matches

@steveb1313•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
6 res: express.Response,
7) {
8 let response = await fetch("https://api.onepeloton.com/auth/login", {
9 method: "POST",
10 mode: "no-cors",

GetPelotonUsermain.tsx3 matches

@steveb1313•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
6 res: express.Response,
7) {
8 let response = await fetch("https://api.onepeloton.com/auth/login", {
9 method: "POST",
10 mode: "no-cors",
20 });
21 const session = await response.json();
22 let userResponse = await fetch(
23 `https://api.onepeloton.com/api/user/${session["user_id"]}`,
24 {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago