1export default async function(req: Request): Promise<Response> {
2 let count = 10;
3 const body = new ReadableStream({
1const msg = new TextEncoder().encode("💩");
2const initialDelay = 20;
3export default async function(req: Request): Promise<Response> {
4 let timerId: number | undefined;
5 const body = new ReadableStream({
6 start(controller) {
7 let currentDelay = initialDelay;
8 function writeToStream() {
9 currentDelay *= 1.03;
10 controller.enqueue(msg);
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function Popup({ isOpen, onClose, content }) {
6 if (!isOpen) return null;
7
43}
44
45function HTMLPreview({ html, isFullView, toggleView }) {
46 return (
47 <div className="html-preview-container">
62}
63
64function App() {
65 const [url, setUrl] = useState('');
66 const [results, setResults] = useState(null);
256}
257
258function client() {
259 createRoot(document.getElementById("root")).render(<App />);
260}
264}
265
266export default async function server(request: Request): Promise<Response> {
267 const url = new URL(request.url);
268
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [url, setUrl] = useState("");
7 const [result, setResult] = useState(null);
211}
212
213function client() {
214 createRoot(document.getElementById("root")).render(<App />);
215}
219}
220
221export default async function server(request: Request): Promise<Response> {
222 const url = new URL(request.url).searchParams.get("url");
223
4import deepThinkAbout from "https://esm.town/v/rozek/GDI_deepThinkAbout";
5
6function App() {
7 const [answer, setAnswer] = useState("");
8 const [isThinking, setIsThinking] = useState(false);
36}
37
38function client() {
39 createRoot(document.getElementById("root")).render(<App />);
40}
44}
45
46export default async function server(request: Request): Promise<Response> {
47 return new Response(
48 `
7
8It contains a simple web page which basically does nothing special but
9demonstrates how to import a function exported from another val.
10
11This val is the companion of
13[https://www.val.town/v/rozek/GDI_deepThinkAbout/](https://www.val.town/v/rozek/GDI_deepThinkAbout)
14
15which contains the function imported by this example.
16
17The code was created using Townie - with only a few small manual corrections.
1export default function deepThinkAbout (Question:string):string {
2 return "42" // unfortunately, we cannot wait 7.5 million years...
3}
6frontend and backend.
7
8It contains a single function which is exported in order to be used by other
9code (e.g., other vals).
10
13[https://www.val.town/v/rozek/GDI_DeepThought/](https://www.val.town/v/rozek/GDI_DeepThought/)
14
15which imports this function and invokes it.
16
17The code was created using Townie - with only a few small manual corrections.
5import { blob } from "https://esm.town/v/std/blob";
6
7function percentileScale(
8 data: number[][],
9 lowerPercentile: number = 1,
25}
26
27function PlotComponent({ data, percentile }) {
28 useEffect(() => {
29 // log percentile
75}
76
77function App() {
78 const [segyData, setSegyData] = useState(null);
79 const [isLoading, setIsLoading] = useState(true);
169}
170
171function client() {
172 createRoot(document.getElementById("root")).render(<App />);
173}
198
199/**
200 * Function to process SEG-Y data passed as a Uint8Array
201 * @param {Uint8Array} data - The binary content of the SEG-Y file as Uint8Array
202 */
203function processSEGY(arrayBuffer) {
204 // Call parseSegy with the ArrayBuffer
205 const traces = parseSegy(arrayBuffer);
211}
212
213export default async function server(request: Request): Promise<Response> {
214 const url = new URL(request.url);
215
10import { html } from "https://esm.town/v/stevekrouse/html";
11
12export default async function(req: Request) {
13 let handler = createStaticHandler(routes);
14 let context = await handler.query(req);
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.