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=666&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 8879 results for "fetch"(4493ms)

53});
54
55export default app.fetch;
56

valPreviewmain.tsx9 matches

@iamseeley•Updated 10 months ago
1export async function fetchVal(valId: string) {
2 try {
3 const response = await fetch(`https://api.val.town/v1/vals/${valId}`);
4 if (!response.ok) {
5 console.error(`Error fetching val with ID ${valId}:`, response.statusText);
6 return null;
7 }
8 return await response.json();
9 } catch (fetchError) {
10 console.error(`Network error fetching val ${valId}:`, fetchError);
11 return null;
12 }
15export async function evalCode(code: string) {
16 try {
17 const response = await fetch(`https://api.val.town/v1/eval`, {
18 method: 'POST',
19 headers: {
40 console.log(`Code evaluation result:`, result);
41 return { result };
42 } catch (fetchError) {
43 console.error(`Network error evaluating code:`, fetchError);
44 return { error: 'Network error: Unable to evaluate code' };
45 }
104
105export function injectValContent(valId: string, elementId: string) {
106 return fetchVal(valId).then(data => {
107 if (data) {
108 const valElement = document.getElementById(elementId);

examain.tsx1 match

@yawnxyz•Updated 10 months ago
31
32// const app = new Hono();
33// export default app.fetch;
34
35
90});
91
92export default app.fetch;
93
61});
62
63export default app.fetch;
64

btcmain.tsx3 matches

@park•Updated 10 months ago
12 try {
13 const [priceResponse, historyResponse] = await Promise.all([
14 fetch(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=${CONFIG.COIN_GECKO_CURRENCY}`),
15 fetch(
16 `https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=${CONFIG.COIN_GECKO_CURRENCY}&days=${CONFIG.COIN_GECKO_DAYS}&interval=daily`,
17 ),
82
83function BitcoinData({ data }) {
84 if (!data) return <p>Failed to fetch Bitcoin data.</p>;
85
86 const supportPrices = generateSupportPrices(data.currentPrice);

uptimemain.tsx2 matches

@pomdtr•Updated 10 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

blob_adminmain.tsx2 matches

@nilesh•Updated 10 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
133});
134
135export default modifyFetchHandler(passwordAuth(app.fetch));

audioManagermain.tsx3 matches

@yawnxyz•Updated 10 months ago
1
2import { OpenAI } from "https://esm.town/v/yawnxyz/OpenAI";
3import { fetch } from "https://esm.town/v/std/fetch";
4
5import { getUrl } from "https://esm.town/v/yawnxyz/download";
180
181
182 // Function to fetch audio data and return as ArrayBuffer
183 async getAudioBuffer(url) {
184 const response = await fetch(url);
185 return await response.arrayBuffer();
186 }

fetchCongressTradeReportsmain.tsx4 matches

@trickster•Updated 10 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3/**
5 Receive daily emails of reported congress trades by scheduling a call to
6
7 @claytn.fetchCongressTradeReports((reports) => console.email(reports))
8*/
9
10
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago