maxm-endlessmazestream.web.val.run
Readme

image.png

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const msg = new TextEncoder().encode("💩");
const delay = 10;
export default async function(req: Request): Promise<Response> {
let timerId: number | undefined;
const body = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(`
<style>
body {
word-wrap: break-word;
line-height: 1em;
}
});
});
</style>
`));
timerId = setInterval(() => {
controller.enqueue(new TextEncoder().encode(Math.random() > 0.5 ? "╱" : "╲"));
}, delay);
},
cancel() {
if (typeof timerId === "number") {
clearInterval(timerId);
}
},
});
return new Response(body, {
headers: {
"Content-Type": "text/html",
},
});
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v7
June 7, 2024