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/%22mailto:kurt@sachersolutions.ca//%22https:/cdn.jsdelivr.net/npm/@mediapipe/hands@0.4.1646424915/hands.min.js/%22?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 19099 results for "fetch"(1826ms)

last-login-demo-1index.tsx12 matches

@stevekrouseUpdated 34 mins ago
33 const [messageInput, setMessageInput] = useState('');
34
35 // Fetch threads when user is logged in
36 useEffect(() => {
37 if (email && threads.length === 0) {
38 fetchThreads();
39 }
40 }, [email]);
41
42 // Fetch messages when thread is selected
43 useEffect(() => {
44 if (selectedThreadId) {
45 fetchMessages(selectedThreadId);
46 } else {
47 setMessages([]);
49 }, [selectedThreadId]);
50
51 const fetchThreads = async () => {
52 try {
53 setLoading(true);
54 const response = await fetch('/api/threads');
55 if (response.ok) {
56 const data = await response.json();
58 }
59 } catch (error) {
60 console.error('Failed to fetch threads:', error);
61 } finally {
62 setLoading(false);
64 };
65
66 const fetchMessages = async (threadId: number) => {
67 try {
68 const response = await fetch(`/api/threads/${threadId}/messages`);
69 if (response.ok) {
70 const data = await response.json();
72 }
73 } catch (error) {
74 console.error('Failed to fetch messages:', error);
75 }
76 };
84
85 try {
86 const response = await fetch(`/api/threads/${selectedThreadId}/messages`, {
87 method: 'POST',
88 headers: {
121 try {
122 setLoading(true);
123 const response = await fetch('/api/threads', {
124 method: 'POST',
125 headers: {

last-login-demo-1index.ts3 matches

@stevekrouseUpdated 42 mins ago
54
55 if (email) {
56 // Fetch user's threads for initial load
57 try {
58 const { rows } = await sqlite.execute(
62 initialData.threads = rows;
63 } catch (error) {
64 console.error('Failed to fetch initial threads:', error);
65 initialData.threads = [];
66 }
270});
271
272export default lastlogin(app.fetch);

nightbottimermain.ts3 matches

@jaydenUpdated 1 hour ago
80}
81
82async function fetchForOwner(owner: Owner) {
83 const r = await sqlite.execute({
84 sql: `
131 // /checktimer
132 if (pathname.endsWith("/checktimer") || pathname.endsWith("/status")) {
133 const timer = await fetchForOwner(nbUser);
134 if (!timer || timer.started_at == null || timer.stopped_at != null) {
135 return send("ℹ️ No running timer.");
142 // /stoptimer
143 if (pathname.endsWith("/stoptimer") || pathname.endsWith("/stop")) {
144 const timer = await fetchForOwner(nbUser);
145 if (!timer || timer.started_at == null || timer.stopped_at != null) {
146 return send("ℹ️ No running timer.");

Hono-playgroundmain.ts1 match

@vyatkaUpdated 2 hours ago
17 return new Response("Made by " + Deno.env.get("Developer"));
18});
19export default app.fetch;

campanhapsdalcoframain.ts1 match

@nmsilvaUpdated 2 hours ago
50 try {
51 // Replace 'YOUR_FORM_ID' with your actual Formspree form ID
52 const response = await fetch("https://formspree.io/f/mpwjgjol", {
53 method: "POST",
54 headers: {

untitled-2672main.ts3 matches

@batUpdated 3 hours ago
6
7export default async function () {
8 const html = await fetchText(URL);
9 const $ = cheerio.load(html);
10 const buyButton = $('.product-form [type="submit"]');
21}
22
23async function fetchText(url: string, options?: any) {
24 const response = await fetch(url, {
25 redirect: "follow",
26 ...(options || {}),

manifoldHttpmain.ts7 matches

@dcm31Updated 5 hours ago
23 e.preventDefault();
24 setResult(null);
25 const res = await fetch("/analyze", {
26 method: "POST",
27 headers: { "content-type": "application/json" },
37 setStatus("Placing test bet on first option...");
38
39 const res = await fetch("/betTest", {
40 method: "POST",
41 headers: { "content-type": "application/json" },
134
135 const apiUrl = `https://manifold.markets/api/v0/slug/${slug}`;
136 const res = await fetch(apiUrl);
137 if (!res.ok) return new Response(`Failed to fetch market: ${res.statusText}`, { status: 500 });
138
139 const data = await res.json();
159
160 const apiUrl = `https://manifold.markets/api/v0/slug/${slug}`;
161 const res = await fetch(apiUrl);
162 if (!res.ok) return new Response(`Failed to fetch market: ${res.statusText}`, { status: 500 });
163
164 const data = await res.json();
169 const first = data.answers.sort((a: any, b: any) => b.probability - a.probability)[0];
170
171 const betRes = await fetch("https://manifold.markets/api/v0/bet", {
172 method: "POST",
173 headers: {

manifoldSummain.ts2 matches

@dcm31Updated 5 hours ago
5
6 const apiUrl = `https://manifold.markets/api/v0/slug/${slug}`;
7 const res = await fetch(apiUrl);
8 if (!res.ok) throw new Error(`Failed to fetch market: ${res.statusText}`);
9 const data = await res.json();
10

gatemain.ts2 matches

@knowUpdated 6 hours ago
437 const pollInterval = setInterval(async () => {
438 try {
439 const response = await fetch(\`\${sourceUrl}?action=status&jobId=\${jobId}\`);
440 const data = await response.json();
441 setTreeData(data.tree);
468
469 try {
470 const response = await fetch(\`\${sourceUrl}?action=start\`, {
471 method: 'POST',
472 headers: { 'Content-Type': 'application/json' },

h6-useUser.tsx4 matches

@werewolf006Updated 6 hours ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const userEndpoint = new URL(USER_ENDPOINT, window.location.origin);
13
14 const res = await fetch(userEndpoint);
15 const data = await res.json();
16 if (!res.ok) {
33
34 useEffect(() => {
35 fetchData();
36 }, []);
37
38 return { data, loading, error, refetch: fetchData };
39}
40

FetchBasic2 file matches

@bengoldUpdated 2 weeks ago

fetch1 file match

@raifyUpdated 2 weeks ago