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/$%7Bsuccess?q=fetch&page=648&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 9134 results for "fetch"(2231ms)

ChatGPTTextDefinitionUserscriptmain.tsx3 matches

@xsec•Updated 8 months ago
464
465 async function makeApiRequest(text) {
466 console.log(`Preparing to send fetch request for text: "${text}"`);
467 try {
468 const response = await fetch(API_CONFIG.url, {
469 ...API_CONFIG,
470 body: JSON.stringify({ selection: text }),
478 } catch (error) {
479 console.error("Error making API request:", error);
480 throw new Error("Failed to fetch definition from the server. Please try again.");
481 }
482 }

caniuse_notifiermain.tsx3 matches

@stevekrouse•Updated 8 months ago
32
33 const url = "https://raw.githubusercontent.com/Fyrd/caniuse/main/fulldata-json/data-1.0.json";
34 const data = await fetch(url).then((res) => res.json());
35 const updatedAt = data.updated;
36
37 if (previousDataUpdatedAt >= updatedAt) return;
38
39 const fetchedFeatures = Object.keys(data.data);
40
41 const features = [];
42 for (const feature of fetchedFeatures) {
43 const previousFeature = previousData?.[feature];
44 const previousUsage = previousFeature?.usage_perc_y ?? 0;

clickTrackerWebsitemain.tsx5 matches

@ankitkr0•Updated 8 months ago
11
12 useEffect(() => {
13 fetchClicks();
14 }, []);
15
16 const fetchClicks = async () => {
17 const response = await fetch('/clicks');
18 const data = await response.json();
19 setClicks(data.clicks);
27 origin: { x: clientX / window.innerWidth, y: clientY / window.innerHeight }
28 });
29 await fetch('/increment', { method: 'POST' });
30 fetchClicks();
31 };
32

bedtimeStoryMakermain.tsx1 match

@daniellevine•Updated 8 months ago
518);
519
520export default app.fetch;

dateme_migratedmain.tsx2 matches

@stevekrouse•Updated 8 months ago
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { form } from "https://esm.town/v/stevekrouse/date_me_form";
3import browse from "https://esm.town/v/stevekrouse/dateme_browse";
13app.get("/faq", faq);
14app.get("/rss.xml", c => dateMeRSS(c.req as unknown as Request));
15export default modifyFetchHandler(app.fetch, {
16 style: `@media (max-width: 500px) {
17 .github-fork-ribbon {

hnCloneLuciaOauthmain.tsx15 matches

@yawnxyz•Updated 8 months ago
16
17 useEffect(() => {
18 fetchStories();
19 fetchUser();
20 }, []);
21
22 const fetchStories = async () => {
23 const response = await fetch('/stories');
24 const data = await response.json();
25 setStories(data);
26 };
27
28 const fetchUser = async () => {
29 const response = await fetch('/user');
30 const data = await response.json();
31 setUser(data.username);
32 };
33
34 const fetchComments = async (storyId) => {
35 const response = await fetch(`/comments/${storyId}`);
36 const data = await response.json();
37 setComments(data);
42 const title = event.target.title.value;
43 const url = event.target.url.value;
44 await fetch('/submit', {
45 method: 'POST',
46 headers: { 'Content-Type': 'application/json' },
47 body: JSON.stringify({ title, url }),
48 });
49 fetchStories();
50 event.target.reset();
51 };
53 const upvoteStory = async (storyId) => {
54 if (!user) return;
55 await fetch('/upvote', {
56 method: 'POST',
57 headers: { 'Content-Type': 'application/json' },
58 body: JSON.stringify({ storyId }),
59 });
60 fetchStories();
61 };
62
64 event.preventDefault();
65 const content = event.target.content.value;
66 await fetch('/comment', {
67 method: 'POST',
68 headers: { 'Content-Type': 'application/json' },
69 body: JSON.stringify({ storyId: currentStory.id, content, parentId }),
70 });
71 fetchComments(currentStory.id);
72 event.target.reset();
73 };
139 <span className="story-link" onClick={() => {
140 setCurrentStory(story);
141 fetchComments(story.id);
142 }}>{story.timestamp}</span>
143 </div>

muddyAmethystLimpetmain.tsx1 match

@pdebieamzn•Updated 8 months ago
27
28 try {
29 const response = await fetch('/upload', {
30 method: 'POST',
31 body: formData,

calendarEventExtractormain.tsx1 match

@pdebieamzn•Updated 8 months ago
24
25 try {
26 const response = await fetch('/upload', {
27 method: 'POST',
28 body: formData,

pdfExtractTextmain.tsx1 match

@pdebieamzn•Updated 8 months ago
3export default async function pdfExtractText(data: ArrayBuffer) {
4 const pdfExtract = new PDFExtract();
5 // const req = await fetch("https://morth.nic.in/sites/default/files/dd12-13_0.pdf");
6 // const data = await req.arrayBuffer();
7 const options: PDFExtractOptions = {}; /* see below */

hackerNewsDigestmain.tsx8 matches

@parkerdavis•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

proxyFetch2 file matches

@vidar•Updated 17 hours ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 1 day ago