init commit,

This commit is contained in:
louiscklaw
2025-05-28 09:55:51 +08:00
commit efe70ceb69
8042 changed files with 951668 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
const msg = new TextEncoder().encode('data: hello\r\n\r\n')
Deno.serve((_) => {
let timerId: number | undefined
const body = new ReadableStream({
start(controller) {
timerId = setInterval(() => {
controller.enqueue(msg)
}, 1000)
},
cancel() {
if (typeof timerId === 'number') {
clearInterval(timerId)
}
},
})
return new Response(body, {
headers: {
'Content-Type': 'text/event-stream',
},
})
})