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/image-url.jpg?q=fetch&page=180&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 10673 results for "fetch"(772ms)

TownieChatRouteSingleColumn.tsx6 matches

@wolf•Updated 1 week ago
50 files={project.data?.files}
51 branchId={branchId}
52 refetch={project.refetch}
53 />
54 </ProjectContext>
60 files,
61 branchId,
62 refetch,
63}: {
64 project: any;
65 files: any[];
66 branchId: string;
67 refetch: () => void;
68}) {
69 const [images, setImages] = useState<(string|null)[]>([]);
94 if (!messages?.length) return;
95 let last = messages.at(-1);
96 if (shouldRefetch(last)) {
97 refetch();
98 }
99 }, [messages]);
177}
178
179function shouldRefetch (message) {
180 for (let i = 0; i < message?.parts?.length; i++) {
181 let part = message.parts[i];

TownieBranchSelect.tsx1 match

@wolf•Updated 1 week ago
32 return;
33 }
34 branches.refetch();
35 if (res?.branch?.id) {
36 navigate(`/chat/${projectId}/branch/${res.branch.id}`);

switchbotmain.tsx2 matches

@stevekrouse•Updated 1 week ago
29 .toString("base64");
30
31 const response = await fetch(`https://api.switch-bot.com/${path}`, {
32 headers: {
33 "Authorization": token,
156});
157
158export default app.fetch;
react-router-hono-starter

react-router-hono-starterREADME.md1 match

@jxnblk•Updated 1 week ago
12
13The routes are defined in `routes` and can include data loading and actions.
14The `/about` route includes a loader that fetches data from the `/api` route, which returns a JSON response.
15The About page uses the `useLoaderData` hook to render the data from the loader in the page.
16

correctlogin.html1 match

@Funfulgence•Updated 1 week ago
46
47 try {
48 const response = await fetch('/api/login/', {
49 method: 'POST',
50 headers: { 'Content-Type': 'application/json' },

stockPricemain.tsx3 matches

@stevekrouse•Updated 1 week ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
3
4async function alphaVantage(symbol: string) {
5 let data = await fetchJSON(
6 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${Deno.env.get("alphaVantage")}`,
7 );
10
11export function getStockData(symbol: string) {
12 return fetchJSON(
13 `${thisWebURL()}?symbol=${symbol}`,
14 );
react-router-hono-starter

react-router-hono-starterserver.tsx1 match

@jxnblk•Updated 1 week ago
44});
45
46export default app.fetch;

TOSindex.ts1 match

@Zoemedia•Updated 1 week ago
46
47// Export the Hono app for HTTP val
48export default app.fetch;

TOSindex.js12 matches

@Zoemedia•Updated 1 week ago
54};
55
56// Fetch and display messages
57const fetchMessages = async () => {
58 try {
59 const response = await fetch('/api/messages');
60 if (!response.ok) {
61 throw new Error('Failed to fetch messages');
62 }
63
72 });
73 } catch (error) {
74 console.error('Error fetching messages:', error);
75 }
76};
94
95 try {
96 const response = await fetch('/api/messages', {
97 method: 'POST',
98 headers: {
109 messageInput.value = '';
110
111 // Fetch updated messages
112 await fetchMessages();
113
114 // Save username
121// Set up polling for new messages
122const setupPolling = () => {
123 // Fetch messages immediately
124 fetchMessages();
125
126 // Then fetch every 3 seconds
127 setInterval(fetchMessages, 3000);
128};
129

cardamumindex.ts1 match

@feb•Updated 1 week ago
255
256// Export the app
257export default app.fetch;

FRAMERFetchBasic1 file match

@bresnik•Updated 7 hours ago

FetchBasic1 file match

@bresnik•Updated 7 hours ago