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=1&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 18940 results for "fetch"(730ms)

postherousedit.html5 matches

@paulkinlan•Updated 1 hour ago
356 try {
357 // Pass password as query parameter for authentication
358 const response = await fetch(`/api/posts/${encodeURIComponent(slug)}?password=${encodeURIComponent(password)}`);
359
360 if (!response.ok) {
518
519 try {
520 const response = await fetch(`/api/posts/${encodeURIComponent(currentPost.slug)}`, {
521 method: 'PUT',
522 headers: {
564
565 try {
566 const response = await fetch(`/api/posts/${encodeURIComponent(currentPost.slug)}?password=${encodeURIComponent(currentPassword)}`, {
567 method: 'DELETE'
568 });
625
626 try {
627 const response = await fetch(`/api/posts/${encodeURIComponent(currentPost.slug)}/images`);
628
629 if (!response.ok) {
711 }
712
713 const response = await fetch('/api/images/upload', {
714 method: 'POST',
715 body: formData
57// Parse RSS feed using Feedsmith
58async function parseRSSFeed(url: string): Promise<RSSFeed> {
59 const response = await fetch(url);
60 if (!response.ok) {
61 throw new Error(`Failed to fetch RSS feed: ${response.status} ${response.statusText}`);
62 }
63
162 };
163
164 const response = await fetch(DISCORD_WEBHOOK_URL, {
165 method: "POST",
166 headers: {

postherousindex.ts15 matches

@paulkinlan•Updated 1 hour ago
699 return c.json({ posts });
700 } catch (error) {
701 console.error("Error fetching posts:", error);
702 return c.json({ error: "Failed to fetch posts" }, 500);
703 }
704});
734 return c.json({ post, activityCounts });
735 } catch (error) {
736 console.error("Error fetching post:", error);
737 return c.json({ error: "Failed to fetch post" }, 500);
738 }
739});
1037 });
1038 } catch (error) {
1039 console.error("Error fetching followers:", error);
1040 return c.json({ error: "Failed to fetch followers" }, 500);
1041 }
1042});
1056 return c.json({ activityCounts });
1057 } catch (error) {
1058 console.error("Error fetching activity counts:", error);
1059 return c.json({ error: "Failed to fetch activity counts" }, 500);
1060 }
1061});
2030 });
2031 } catch (error) {
2032 console.error("Error fetching post images:", error);
2033 return c.json({ error: "Failed to fetch images" }, 500);
2034 }
2035});
2064 });
2065 } catch (error) {
2066 console.error("Error fetching user images:", error);
2067 return c.json({ error: "Failed to fetch images" }, 500);
2068 }
2069});
2129 });
2130 } catch (error) {
2131 console.error("Error fetching all images:", error);
2132 return c.json({ error: "Failed to fetch images" }, 500);
2133 }
2134});
2174});
2175
2176export default app.fetch;

iiif44tumain.tsx5 matches

@sammeltassen•Updated 1 hour ago
5const iiifBaseUrl = "https://data.4tu.nl/iiif/v3/";
6
7async function fetchJson(url: string, token: string | null = null) {
8 const headers = new Headers();
9 if (token) {
10 headers.append("Authorization", `token ${token}`);
11 }
12 return fetch(url, { headers }).then((resp) => resp.ok ? resp.json() : null);
13}
14
75 }
76 const token = params.get("token");
77 const metadata = await fetchJson(
78 (token ? privateApiUrl : publicApiUrl) + "/" + datasetUuid,
79 token,
85 const images = await Promise.all(
86 metadata.files.map((i: any) =>
87 fetchJson(iiifBaseUrl + i.uuid + "/info.json").then((resp) => {
88 if (resp) {
89 return { ...resp, meta: i };
90 } else {
91 console.log("Could not fetch", i);
92 return null;
93 }

gesturemain.ts5 matches

@know•Updated 3 hours ago
265 isRequestInFlight = true;
266 try {
267 const res = await fetch(\`\${API_URL}?action=classify\`, {
268 method: 'POST',
269 headers: {'Content-Type': 'application/json'},
368/**
369 * Ensures the 3D model is loaded and stored in the blob store.
370 * This is done once to avoid fetching it on every request.
371 */
372async function getModelDataUri(): Promise<string> {
378
379 if (!dataUri) {
380 console.log("3D model not found in blob store. Fetching and caching...");
381 const response = await fetch(MODEL_URL);
382 if (!response.ok) {
383 throw new Error(`Failed to fetch model: ${response.statusText}`);
384 }
385 const buffer = await response.arrayBuffer();

FFS_Frame_Custom_actionsmain.ts1 match

@isakarim•Updated 4 hours ago
232 if (startUrl && startToken) {
233 try {
234 const resp = await fetch(startUrl, {
235 method: "POST",
236 headers: {

untitled-5100main.ts5 matches

@chatgot•Updated 5 hours ago
50 // Update your debug mode to show all teams and IDs
51 if (mode === "debug") {
52 const response = await fetch(
53 `${baseUrl}?view=mTeam&view=mSettings&scoringPeriodId=2`,
54 {
96 `${baseUrl}?view=mMatchup&view=mMatchupScore&view=mTeam&view=mSettings&view=mBoxscore&view=mScoreboard&scoringPeriodId=${targetWeek}`;
97
98 const response = await fetch(apiUrl, {
99 method: "GET",
100 headers: {
169 const apiUrl = `${baseUrl}?view=mTeam&view=mStandings&view=mSettings`;
170
171 const response = await fetch(apiUrl, {
172 method: "GET",
173 headers: {
239 `${baseUrl}?view=mRoster&view=mTeam&view=mLiveScoring&view=mMatchupScore&scoringPeriodId=${currentWeek}&teamId=${actualTeamId}`;
240
241 const response = await fetch(apiUrl, {
242 method: "GET",
243 headers: {
311 } catch (error) {
312 return Response.json({
313 error: "Failed to fetch fantasy data",
314 details: error.message,
315 });

valmain.ts8 matches

@realtime•Updated 6 hours ago
282 const notification = document.getElementById('notification');
283
284 async function apiFetch(endpoint, options = {}, retries = 3, delay = 1000) {
285 for (let i = 0; i < retries; i++) {
286 try {
287 const response = await fetch(API_URL + endpoint, options);
288 if (!response.ok) {
289 const error = await response.json();
339 try {
340 statusMessage.textContent = 'Loading objectives...';
341 const goals = await apiFetch('api/goals');
342 renderGoals(goals);
343 } catch (error) {
355
356 try {
357 await apiFetch('api/goals', {
358 method: 'POST',
359 headers: { 'Content-Type': 'application/json' },
384 const isComplete = subtaskCheckbox.checked;
385 try {
386 const result = await apiFetch(\`api/subtasks/\${subtaskId}\`, {
387 method: 'PUT',
388 headers: { 'Content-Type': 'application/json' },
411 if (confirm('Are you sure you want to delete this objective?')) {
412 try {
413 await apiFetch(\`api/goals/\${goalId}\`, { method: 'DELETE' });
414 await loadGoals();
415 } catch (error) {
433const app = new Hono();
434
435// GET /api/goals - Fetches all goals
436app.get("/api/goals", async (c) => {
437 const goals = await getGoals();
565 const apiPath = url.pathname.substring(4);
566 const apiReq = new Request(new URL(apiPath, "http://localhost"), req);
567 return app.fetch(apiReq);
568 }
569

untitled-6341server.tsx1 match

@dumbanimal•Updated 7 hours ago
22
23// Start server
24export default app.fetch;

redzonemain.ts11 matches

@chatgot•Updated 7 hours ago
15 let cached = await blob.getJSON(cacheKey);
16
17 // Fetch fresh data in background (always)
18 const fetchFreshData = async () => {
19 let freshData;
20
23 const scoreboardUrl =
24 `https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard`;
25 const scoreboard = await fetch(scoreboardUrl).then((r) => r.json());
26
27 const liveGames = scoreboard.events?.filter((e) =>
47 const gamesWithPlays = await Promise.all(
48 liveGames.map(async (game) => {
49 const summary = await fetch(
50 `https://site.api.espn.com/apis/site/v2/sports/football/nfl/summary?event=${game.id}`,
51 )
130 : `https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard`;
131
132 const scoreboard = await fetch(scoreboardUrl).then((r) => r.json());
133 const game = scoreboard.events?.find((e) =>
134 e.shortName.toLowerCase().includes(team.toLowerCase())
138 freshData = { error: `No game found for team: ${team}` };
139 } else {
140 const details = await fetch(
141 `https://site.api.espn.com/apis/site/v2/sports/football/nfl/summary?event=${game.id}`,
142 )
220 : `https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard`;
221
222 const data = await fetch(endpoint).then((r) => r.json());
223
224 const games = data.events?.map((game) => {
270 // If we have cached data that's 20+ seconds old, return it
271 if (cached && (now - cached.timestamp >= 20000)) {
272 // Fetch fresh data in background for next request
273 fetchFreshData(); // Don't await - let it run async
274
275 // Return the delayed data
277 }
278
279 // If no valid cache or cache too fresh, fetch and wait
280 const freshData = await fetchFreshData();
281
282 // If the data is for live games, note that next request will be delayed

FetchBasic2 file matches

@bengold•Updated 1 week ago

fetch1 file match

@raify•Updated 2 weeks ago