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=176&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 9090 results for "fetch"(1447ms)

stevensDemoApp.tsx17 matches

@satcar•Updated 3 weeks ago
82 const [cookieAndTeaMode, setCookieAndTeaMode] = useState(false);
83
84 // Fetch images from backend instead of blob storage directly
85 useEffect(() => {
86 // Set default background color in case image doesn't load
89 }
90
91 // Fetch avatar image
92 fetch("/api/images/stevens.jpg")
93 .then((response) => {
94 if (response.ok) return response.blob();
103 });
104
105 // Fetch wood background
106 fetch("/api/images/wood.jpg")
107 .then((response) => {
108 if (response.ok) return response.blob();
129 }, []);
130
131 const fetchMemories = useCallback(async () => {
132 setLoading(true);
133 setError(null);
134 try {
135 const response = await fetch(API_BASE);
136 if (!response.ok) {
137 throw new Error(`HTTP error! status: ${response.status}`);
154 }
155 } catch (e) {
156 console.error("Failed to fetch memories:", e);
157 setError(e.message || "Failed to fetch memories.");
158 } finally {
159 setLoading(false);
162
163 useEffect(() => {
164 fetchMemories();
165 }, [fetchMemories]);
166
167 const handleAddMemory = async (e: React.FormEvent) => {
176
177 try {
178 const response = await fetch(API_BASE, {
179 method: "POST",
180 headers: { "Content-Type": "application/json" },
188 setNewMemoryTags("");
189 setShowAddForm(false);
190 await fetchMemories();
191 } catch (e) {
192 console.error("Failed to add memory:", e);
199
200 try {
201 const response = await fetch(`${API_BASE}/${id}`, {
202 method: "DELETE",
203 });
205 throw new Error(`HTTP error! status: ${response.status}`);
206 }
207 await fetchMemories();
208 } catch (e) {
209 console.error("Failed to delete memory:", e);
231
232 try {
233 const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
234 method: "PUT",
235 headers: { "Content-Type": "application/json" },
240 }
241 setEditingMemory(null);
242 await fetchMemories();
243 } catch (e) {
244 console.error("Failed to update memory:", e);

updateValByNameupdateValByID2 matches

@nbbaier•Updated 3 weeks ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3interface UpdateValArgs {
20 };
21
22 return fetchJSON(`https://api.val.town/v1/vals/${valId}`, {
23 headers: {
24 Authorization: `Bearer ${token}`,

fetchPaginatedDatamain.tsx1 match

@nbbaier•Updated 3 weeks ago
1export { fetchPaginatedData } from "https://esm.town/v/nbbaier/utilities/pagination/fetchPaginatedData";

EmailAttachmentLogindex.ts2 matches

@wolf•Updated 3 weeks ago
67});
68
69// Export the fetch handler
70export default app.fetch;

EmailAttachmentLogApp.tsx4 matches

@wolf•Updated 3 weeks ago
39
40 useEffect(() => {
41 const fetchAttachments = async () => {
42 try {
43 const response = await fetch("/api/attachments");
44 if (!response.ok) {
45 throw new Error("Failed to fetch attachments");
46 }
47 const data = await response.json();
54 };
55
56 fetchAttachments();
57 }, []);
58

fiberplaneHonoZodStarterindex.ts1 match

@crisscrossed•Updated 3 weeks ago
105});
106
107export default app.fetch;

EmailAttachmentLogindex.ts2 matches

@wolf•Updated 3 weeks ago
56});
57
58// Export the fetch handler
59export default app.fetch;

EmailAttachmentLogApp.tsx4 matches

@wolf•Updated 3 weeks ago
67 }
68
69 // Fetch attachments
70 fetch('/api/attachments')
71 .then(response => {
72 if (!response.ok) {
73 throw new Error('Failed to fetch attachments');
74 }
75 return response.json();
80 })
81 .catch(err => {
82 console.error('Error fetching attachments:', err);
83 setError('Failed to load attachments');
84 setLoading(false);

statusmonitor2 matches

@crisscrossed•Updated 3 weeks ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

templateTwitterAlertmain.tsx1 match

@fredmoon•Updated 3 weeks ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

proxyFetch2 file matches

@vidar•Updated 6 hours ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 21 hours ago