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=40&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 8210 results for "fetch"(1002ms)

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(

live-reloadclient.ts2 matches

@stevekrouse•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;

live-reload-demomain.tsx1 match

@stevekrouse•Updated 4 days ago
15
16// Enable live reloading
17export default liveReload(app.fetch, import.meta.url);

GitHub-trending-summarysummarize-to-email1 match

@ynonp•Updated 4 days ago
4import { NodeHtmlMarkdown, NodeHtmlMarkdownOptions } from "npm:node-html-markdown";
5
6const html = await fetch("https://github.com/trending").then(r => r.text());
7
8const { window: { document } } = new JSDOM(html);

minemain.tsx1 match

@yassinreg•Updated 4 days ago
25
26 try {
27 const response = await fetch(window.location.href, {
28 method: "POST",
29 body: formData,

sqliteExplorerAppmain.tsx4 matches

@skynocover•Updated 4 days ago
1/** @jsxImportSource npm:hono/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

Lairmain.tsx14 matches

@Get•Updated 4 days ago
2// A more declarative and extensible multi-agent platform structure.
3
4import { fetch } from "https://esm.town/v/std/fetch"; // Assuming Val Town environment
5
6// --- Core Interfaces ---
296}
297
298// Agent 2: Fetch External Data (modified for new signature)
299async function fetchAgent(
300 input: AgentInput<{ url?: string }>, // Optionally allow URL via input
301 context: AgentContext,
305 const url = payload?.url || "https://jsonplaceholder.typicode.com/todos/1"; // Default URL
306
307 log('INFO', 'FetchAgent', `Start fetching data from ${url}`);
308 try {
309 const resp = await fetch(url);
310 if (!resp.ok) {
311 throw new Error(`Workspace failed: Server responded with status ${resp.status} ${resp.statusText}`);
313 const data = await resp.json();
314
315 log('SUCCESS', 'FetchAgent', `Data fetched successfully`, { url, responseStatus: resp.status });
316 return { mandateId, correlationId: taskId, payload: { data } };
317 } catch (e: any) {
318 log('ERROR', 'FetchAgent', `Workspaceing failed`, e);
319 return { mandateId, correlationId: taskId, payload: { data: null }, error: e.message };
320 }
325const analysisWorkflow: WorkflowDefinition = {
326 id: "basicAnalysis",
327 description: "Summarizes user text and fetches placeholder data.",
328 steps: [
329 {
335 },
336 {
337 id: "step2_fetchData",
338 agent: "fetcher",
339 // No input mapping needed if the agent uses defaults or doesn't require specific input from workflow state
340 input: {} // Explicitly empty
345 outputMapping: { // Define the final output structure
346 finalSummary: { source: "step1_summarize", field: "summary" },
347 externalData: { source: "step2_fetchData", field: "data"},
348 }
349};
358// Register agents
359agentRegistry.register("summarizer", summarizerAgent);
360agentRegistry.register("fetcher", fetchAgent);
361// Register more agents...
362// agentRegistry.register("sentimentAnalyzer", sentimentAgent);
410
411 try {
412 const res = await fetch(window.location.pathname, {
413 method: 'POST',
414 headers: { 'Content-Type': 'application/json' },
430
431 } catch (err) {
432 resultBox.textContent = 'Fetch Error: ' + err.message;
433 resultBox.className = 'error';
434 logBox.textContent = 'Failed to communicate with the backend.';

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago