39 scene.add(butterfly);
40
41 renderer.setAnimationLoop(function animate(time) {
42 renderer.render(scene, camera);
43 butterfly.rotation.y += 0.01;
5
6// Initialize database table
7async function initDatabase() {
8 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${EMAIL_TABLE} (
9 id INTEGER PRIMARY KEY AUTOINCREMENT,
17}
18
19export default async function(req: Request): Promise<Response> {
20 const url = new URL(req.url);
21
361 let manualTheme = localStorage.getItem('theme');
362
363 function applyTheme() {
364 let isDark = manualTheme ? manualTheme === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches;
365
379 }
380
381 function toggleTheme() {
382 const systemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
383 manualTheme = manualTheme === null ? (systemDark ? 'light' : 'dark') :
388
389 // Iframe expansion
390 function toggleExpand() {
391 const frame = document.getElementById('soccerFrame');
392 const overlay = document.getElementById('overlay');
406 }
407
408 function toggleExpandRundown() {
409 const frame = document.getElementById('rundownFrame');
410 const overlay = document.getElementById('overlay');
425
426 // Close on overlay click
427 document.getElementById('overlay').addEventListener('click', function() {
428 if (document.getElementById('soccerFrame').classList.contains('expanded')) {
429 toggleExpand();
4import { styles } from "./styles.tsx?hi=bloop";
5
6function App () {
7 return (
8 <html>
23}
24
25export default async function (req: Request): Promise<Response> {
26 const html = renderToString(<App />);
27 return new Response(html, {
5type Blob = Awaited<ReturnType<typeof blob.list>>[number];
6
7export function BlobPage({ name, error, type, text, metadata }: {
8 name: string;
9 metadata?: Blob;
3import { renderToString } from "https://esm.sh/react-dom@19/server";
4
5function App () {
6 return (
7 <html>
22 transitionProperty: "background-color, color",
23 transitionDuration: "1s",
24 transitionTimingFunction: "ease-in-out",
25 "&:hover": {
26 backgroundColor: "magenta",
45}
46
47export default async function (req: Request): Promise<Response> {
48 const html = renderToString(<App />);
49 return new Response(html, {
1/** @jsxImportSource npm:hono/jsx */
2
3export function Layout({ children, showLogout = true }) {
4 return (
5 <html>
2// Click "Run", copy and paste the email address and send an email to it.
3// This example will log the email details received.
4export default async function emailHandler(email: Email){
5 console.log("Email received!", email.from, email.subject, email.text);
6 for (const file of email.attachments) {
2// Configure the timer with the 🕒 icon in the top right.
3// This example just logs the current time.
4export function scheduledHandler() {
5 const timestamp = new Date().toISOString();
6 console.log(`Cron val executed at: ${timestamp}`);
2// Access it via its public URL (you can also pick a nicer subdomain).
3// Try adding ?name=YourName to the URL!
4export default function httpHandler(req: Request): Response {
5 const url = new URL(req.url);
6 const name = url.searchParams.get("name") || "Friend";
Simple functional CSS library for Val Town
A helper function to build a file's email
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.