23export const sqlite = createClient({
4url: "https://api.val.town/v2/sqlite/",
5authToken: Deno.env.get("VAL_TOWN_API_KEY"),
6});
1# SQLite2 - [Docs ↗](https://docs.val.town/std/sqlite)
23_This is our second generation SQLite client: it exposes a different API than [std/sqlite](https://www.val.town/v/std/sqlite).
4Specifically, this will support the full [@libsql/client interface](https://docs.turso.tech/sdk/ts/reference#simple-query)._
5
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
stylishScarletPossummain.tsx1 match
6async function fetchRandomJoke() {
7const response = await fetch(
8"https://official-joke-api.appspot.com/random_joke",
9);
10return response.json();
modestPurpleLousemain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
proficientTealFrogmain.tsx1 match
4function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
inspiringTomatoFleamain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
efficientBronzeKoimain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
commendableTealFerretmain.tsx10 matches
65const mapRef = useRef(null);
66const [searchQuery, setSearchQuery] = useState('');
67const [mapInstance, setMapInstance] = useState(null);
68const [isLeafletLoaded, setIsLeafletLoaded] = useState(false);
69const [mapLoadError, setMapLoadError] = useState(null);
101// Search functionality
102const handleSearch = useCallback(async () => {
103if (!searchQuery || !mapInstance || !window.L) return;
104105try {
116// Remove previous search marker if exists
117if (window.searchMarker) {
118mapInstance.removeLayer(window.searchMarker);
119}
120126iconSize: [20, 20]
127})
128}).addTo(mapInstance);
129130// Store the marker globally to remove it later
132133// Center map on searched location
134mapInstance.setView([lat, lon], 15);
135136// Create a popup for the searched location
148</div>
149`)
150.openOn(mapInstance);
151152// Add event listener to confirm location
169console.error('Search failed', error);
170}
171}, [searchQuery, mapInstance, onLocationSelect]);
172173// Map initialization effect
174useEffect(() => {
175// Ensure Leaflet is loaded and map container exists
176if (isLeafletLoaded && window.L && mapRef.current && !mapInstance) {
177try {
178const L = window.L;
183184// Store map instance
185setMapInstance(map);
186187L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
304}
305}
306}, [isLeafletLoaded, locations, defaultLocation, onLocationFound, onLocationSelect, mapInstance]);
307308// Render error state if map loading fails
observantApricotGoatmain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();