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/$%7Bart_info.art.src%7D?q=fetch&page=34&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 8156 results for "fetch"(3179ms)

live-reload2utils.ts3 matches

@dcm31•Updated 4 days ago
93}
94/**
95 * Creates a wrapper around a fetch handler that injects an HTML string
96 * into the document. It first checks for a <body> tag; if missing,
97 * it looks for an <html> tag. If neither are present, it appends to
98 * the full text response.
99 *
100 * @param handler The original fetch handler function
101 * @param html The HTML content to inject
102 * @returns A new fetch handler with HTML rewriting
103 */
104export function injectHTML(

live-reload2README.md2 matches

@dcm31•Updated 4 days ago
20import { liveReload } from "https://esm.town/v/stevekrouse/live-reload/main.ts";
21
22const handler = (req: Request) => { /* your fetch handler */}
23export default liveReload(handler, import.meta.url);
24```
59
60// Enable live reloading
61export default liveReload(app.fetch, import.meta.url);
62```
63

live-reload2error-proxy.ts1 match

@dcm31•Updated 4 days ago
7 return new Response(`Learn more at https://www.val.town/x/stevekrouse/live-reload`);
8 }
9 const resp = await fetch(targetURL, {
10 headers: req.headers,
11 });

live-reload2client.ts2 matches

@dcm31•Updated 4 days ago
6 */
7async function registerLongPoll({ pageLoadedAt }: { pageLoadedAt: number }) {
8 const { lastUpdatedAt, status } = await (await fetch("/__lastUpdatedAt")).json();
9 if (lastUpdatedAt > pageLoadedAt) {
10 window.location.href = `https://reload.val.run?${new URLSearchParams({ url: window.location.href })}`;
28 return;
29 }
30 const resp = await fetch(targetURL);
31 if (resp.ok) {
32 window.location.href = targetURL;

HTTP_exampleshonoExample1 match

@valdottown•Updated 4 days ago
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;

HTTP101GETrequestFormGuide1 match

@willthereader•Updated 4 days ago
113const app = new Hono();
114app.get("/", HTTP_Guide);
115export default app.fetch;
116
117/*<h4>What is the blank element?</h4>

OpenTownie_jacksonuseThreads.tsx5 matches

@stevekrouse•Updated 4 days ago
10 const [error, setError] = useState(null);
11
12 const fetchData = async () => {
13 try {
14 const res = await fetch(ENDPOINT, {
15 headers: {
16 "Authorization": "Bearer " + token,
18 });
19 const data = await res.json();
20 console.log("useThreads fetchData", { res, data });
21 if (!res.ok) {
22 console.error(data);
39
40 useEffect(() => {
41 fetchData();
42 }, []);
43
44 return { data, loading, error, refetch: fetchData };
45}

OpenTownie_jacksonindex.ts1 match

@stevekrouse•Updated 4 days ago
25
26// This is the entry point for HTTP vals
27export default app.fetch;

OpenTownie_jacksonsend-message.ts3 matches

@stevekrouse•Updated 4 days ago
100 }
101
102 // If there are selected files, fetch their content and add them to the messages
103 if (selectedFiles && selectedFiles.length > 0) {
104 try {
118 fileContents += `## File: ${filePath}\n\`\`\`\n${fileWithLinesNumbers(content)}\n\`\`\`\n\n`;
119 } catch (error) {
120 console.error(`Error fetching file ${filePath}:`, error);
121 fileContents += `## File: ${filePath}\nError: Could not fetch file content\n\n`;
122 }
123 }

live-reloadutils.ts3 matches

@stevekrouse•Updated 4 days ago
93}
94/**
95 * Creates a wrapper around a fetch handler that injects an HTML string
96 * into the document. It first checks for a <body> tag; if missing,
97 * it looks for an <html> tag. If neither are present, it appends to
98 * the full text response.
99 *
100 * @param handler The original fetch handler function
101 * @param html The HTML content to inject
102 * @returns A new fetch handler with HTML rewriting
103 */
104export function injectHTML(

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago