17 lines
291 B
TypeScript
17 lines
291 B
TypeScript
// stream() demo. Counts.
|
|
|
|
import { stream } from "@/stream"
|
|
|
|
export default async function () {
|
|
let count = 1
|
|
|
|
return stream(<p>{count}</p>, async ({ replace }) => {
|
|
for (let i = 1; i < 10; i++) {
|
|
await Bun.sleep(250)
|
|
|
|
count++
|
|
replace(<p>{count}</p>)
|
|
}
|
|
})
|
|
}
|