BROWSER_BOARD
tcmts.cli.test.e2e.traces.BROWSER_BOARD · #pmmo2xcr · term · runs anywhere
export const BROWSER_BOARD = `// tcm: namespace board
import { table } from "#codebase/lib/server";
export const posts = table<{ text: string }>("posts");
export async function add(text: string): Promise<string> {
return posts.insert({ text });
}
export async function submit(): Promise<void> {
await add("hi");
document.body.dataset.added = String(Number(document.body.dataset.added ?? 0) + 1);
}
export async function main() {
const b = document.createElement("button");
b.onclick = () => void submit();
document.body.append(b);
}
`
used by