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//%22$%7Bad.imageUrl%7D/%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 19032 results for "fetch"(768ms)

untitled-8620main.ts2 matches

@know•Updated 46 mins ago
502
503 try {
504 const response = await fetch(\`\${API_BASE_URL}/start\`, {
505 method: 'POST',
506 headers: { 'Content-Type': 'application/json' },
525 const pollJobStatus = async () => {
526 try {
527 const response = await fetch(\`\${API_BASE_URL}/status?jobId=\${jobId}\`);
528 if (!response.ok) throw new Error('Polling failed');
529

untitled-8620main.ts2 matches

@realtime•Updated 55 mins ago
419
420 try {
421 const response = await fetch(\`\${API_BASE_URL}/start\`, {
422 method: 'POST',
423 headers: { 'Content-Type': 'application/json' },
442 const pollJobStatus = async () => {
443 try {
444 const response = await fetch(\`\${API_BASE_URL}/status?jobId=\${jobId}\`);
445 if (!response.ok) throw new Error('Polling failed');
446

brew_countermain.ts1 match

@lazysous•Updated 2 hours ago
187 <div id="analytics">Loading...</div>
188 <script>
189 fetch('/analytics')
190 .then(r => r.json())
191 .then(data => {

TownieuseUser.tsx4 matches

@Skywalker•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

TownieuseProject.tsx5 matches

@Skywalker•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

TownieuseProjects.tsx4 matches

@Skywalker•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

TownieuseCreditBalance.tsx6 matches

@Skywalker•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}

TownieuseCreateProject.tsx1 match

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

TownieuseCreateBranch.tsx1 match

@Skywalker•Updated 3 hours ago
12 setData(null);
13 setError(null);
14 const res = await fetch(ENDPOINT, {
15 method: "POST",
16 body: JSON.stringify({

TownieuseBranches.tsx4 matches

@Skywalker•Updated 3 hours ago
7 const [loading, setLoading] = useState(true);
8
9 const fetchData = async () => {
10 const endpoint = new URL(ENDPOINT, window.location.origin);
11 endpoint.searchParams.append("projectId", projectId);
12
13 const res = await fetch(endpoint)
14 .then(res => res.json());
15 setData(res.branches);
19 useEffect(() => {
20 if (!projectId) return;
21 fetchData();
22 }, [projectId]);
23
24 return { data, loading, refetch: fetchData };
25}

FetchBasic2 file matches

@bengold•Updated 2 weeks ago

fetch1 file match

@raify•Updated 2 weeks ago