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/?q=fetch&page=314&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 4158 results for "fetch"(533ms)

welcomingPinkAlligatormain.tsx1 match

@stevekrouse•Updated 5 months ago
85
86 try {
87 const response = await fetch("/", {
88 method: "POST",
89 body: JSON.stringify({ prompt, currentCode: code, errorMessage: shaderErrorMessage }),

welcomingPinkAlligatormain.tsx1 match

@stevekrouse•Updated 5 months ago
85
86 try {
87 const response = await fetch("/", {
88 method: "POST",
89 body: JSON.stringify({ prompt, currentCode: code, errorMessage: shaderErrorMessage }),

bsky_rss_pollmain.tsx2 matches

@stevekrouse•Updated 5 months ago
1import { rss_to_bsky } from "https://esm.town/v/jordan/rss_to_bsky";
2import { blob } from "https://esm.town/v/std/blob";
3import { fetch } from "https://esm.town/v/std/fetch";
4
5export async function bsky_rss_poll() {
6 const { parseFeed } = await import("https://deno.land/x/rss/mod.ts");
7 const res = await fetch("https://v8.dev/blog.atom")
8 .then(res => res.text())
9 .then(res => parseFeed(res));

openaimain.tsx1 match

@std•Updated 5 months ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

reqEvaltownmain.tsx1 match

@vawogbemi•Updated 5 months ago
32 const url = new URL("." + pathname, "http://localhost:" + port);
33 url.search = search;
34 const resp = await fetch(url, {
35 method: req.method,
36 headers: req.headers,

valtowntownmain.tsx1 match

@vawogbemi•Updated 5 months ago
174});
175
176export default app.fetch.bind(app);
177
178const css = `

verbalScarletAntelopemain.tsx12 matches

@vawogbemi•Updated 5 months ago
60 }, [state.loading, state.hasMore]);
61
62 const fetchStories = async () => {
63 try {
64 const response = await fetch("/api/stories");
65 if (!response.ok) throw new Error("Failed to fetch dates");
66 const data = await response.json();
67 setStories(data);
69 }
70 catch (err) {
71 console.error("Error fetching stories:", err);
72 }
73 };
74
75 const fetchComments = async (query: string, story: string, page: number) => {
76 try {
77 dispatch({ type: "loading", value: true });
78 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
79 if (!response.ok) throw new Error("Failed to fetch comments");
80 const data = await response.json();
81 setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84 dispatch({ type: "loading", value: false });
85 } catch (err) {
86 console.error("Error fetching comments:", err);
87 dispatch({ type: "loading", value: false });
88 }
99 dispatch({ type: "hasMore", value: true });
100 dispatch({ type: "query", value: newQuery });
101 fetchComments(fullQuery, state.story, 1);
102 };
103
104 useEffect(() => {
105 fetchStories();
106
107 const handleScroll = () => {
122 : "";
123 const fullQuery = `${filtersQuery} ${state.query}`;
124 fetchComments(fullQuery, state.story, state.page);
125 }
126 }
408 tags: `comment, story_${story}`,
409 page: 0,
410 hitsPerPage: 100, // Fetch a moderate number of comments
411 });
412

jubilantMagentaMitemain.tsx3 matches

@youchen•Updated 6 months ago
30
31 modifiedRequest.headers.set("Referer", `${EMBY_SERVER}/web/index.html`);
32 return fetch(modifiedRequest);
33 }
34 }
47 modifiedRequest.headers.set("Connection", request.headers.get("Connection") || "close");
48
49 return fetch(modifiedRequest);
50}
51
52addEventListener("fetch", event => {
53 event.respondWith(handleRequest(event.request));
54});

worthyCyanRoundwormmain.tsx2 matches

@vawogbemi•Updated 6 months ago
246 e.preventDefault();
247 const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
248 const response = await fetch("/create-checkout-session", {
249 method: "POST",
250 headers: { "Content-Type": "application/json" },
504 }
505
506 // Fetch all tips for the root endpoint
507 const allTips = await sqlite.execute(
508 `SELECT name, amount, comment, timestamp FROM ${KEY}_payments_${SCHEMA_VERSION} ORDER BY amount DESC`,

forbearingAmethystToadmain.tsx2 matches

@vawogbemi•Updated 6 months ago
246 e.preventDefault();
247 const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
248 const response = await fetch("/create-checkout-session", {
249 method: "POST",
250 headers: { "Content-Type": "application/json" },
504 }
505
506 // Fetch all tips for the root endpoint
507 const allTips = await sqlite.execute(
508 `SELECT name, amount, comment, timestamp FROM ${KEY}_payments_${SCHEMA_VERSION} ORDER BY amount DESC`,

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago