postpostscript
provideBlob
HTTP
provideBlob: Return Response Quickly and Poll for the Expensive Parts Example: See @postpostscript/provideBlobExample for full example. You will need to fork this val to use provideBlob on your projects as it uses @std/blob for storage import { Image } from "https://deno.land/x/imagescript@1.2.17/mod.ts";
import { htmlResponse } from "https://esm.town/v/postpostscript/html";
import { provideBlob } from "https://esm.town/v/postpostscript/provideBlob";
export default async function(req: Request) {
const image = provideBlob(async () => {
const png = new Image(100, 100);
png.drawCircle(50, 50, 50, 100);
return png.encode();
}).jsPromise();
return htmlResponse`
<div id="image"></div>
<script>
${image}.then(blob => {
const $img = document.createElement("img")
$img.src = URL.createObjectURL(blob)
document.getElementById("image").appendChild($img)
})
</script>
`;
}
0

stevekrouse
sparklineEx
HTTP
Server-Rendered React Sparkline Example Vaguely inspired by Easy SVG sparklines , but totally different because that had zero dependencies and this has all the dependencies: react, htm, react-sparklines. This is the live-generated SVG that this very val generates:  It visualizes the amount of times that it itself has been viewed. The data for this val is kept in @stevekrouse.sparklineExData .
0
Updated: August 13, 2024