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/%22https:/unpkg.com/three@0.160.0/build/three.min.js//%22/inference?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 19095 results for "fetch"(824ms)

untitled-2672main.ts3 matches

@bat•Updated 40 mins 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 || {}),

campanhapsdalcoframain.ts1 match

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

manifoldHttpmain.ts7 matches

@dcm31•Updated 2 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

@dcm31•Updated 2 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

@know•Updated 3 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

@werewolf006•Updated 3 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

h6-useProject.tsx5 matches

@werewolf006•Updated 3 hours ago
9 const [error, setError] = useState(null);
10
11 const fetchData = async () => {
12 try {
13 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
17 if (branchId) filesEndpoint.searchParams.append("branchId", branchId);
18
19 const { project } = await fetch(projectEndpoint).then((res) =>
20 res.json()
21 );
22 const { files } = await fetch(filesEndpoint).then((res) => res.json());
23
24 setData({ project, files });
34 useEffect(() => {
35 if (!projectId) return;
36 fetchData();
37 }, [projectId, branchId]);
38
39 return { data, loading, error, refetch: fetchData };
40}
41

h6-useProjects.tsx4 matches

@werewolf006•Updated 3 hours ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const res = await fetch(ENDPOINT);
13 const data = await res.json();
14 if (!res.ok) {
32
33 useEffect(() => {
34 fetchData();
35 }, []);
36
37 return { data, loading, error, refetch: fetchData };
38}
39

h6-useCreditBalance.tsx6 matches

@werewolf006•Updated 3 hours ago
6 const [loading, setLoading] = useState(true);
7
8 const fetchBalance = async () => {
9 try {
10 const response = await fetch("/api/credit-balance");
11 if (response.ok) {
12 const data = await response.json();
13 setBalance(data.balance);
14 } else {
15 console.error("Failed to fetch balance");
16 }
17 } catch (err) {
18 console.error("Error fetching balance:", err);
19 } finally {
20 setLoading(false);
23
24 useEffect(() => {
25 fetchBalance();
26 }, []);
27
28 return { balance, loading, refetch: fetchBalance };
29}

h6-useCreateProject.tsx1 match

@werewolf006•Updated 3 hours ago
19 setError(null);
20 try {
21 const res = await fetch(ENDPOINT, {
22 method: "POST",
23 headers: {

FetchBasic2 file matches

@bengold•Updated 2 weeks ago

fetch1 file match

@raify•Updated 2 weeks ago