feat: allow render function to be asynchronous (#142)

This commit is contained in:
ʀᴀʏ
2022-04-23 15:17:00 +02:00
committed by GitHub
parent 49d2e54335
commit bb9fa4a09f
4 changed files with 12 additions and 11 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { RenderContext, RenderFn } from "../../../server.ts";
export function render(_ctx: RenderContext, render: RenderFn) {
export async function render(_ctx: RenderContext, render: RenderFn) {
await new Promise<void>((r) => r());
const body = render();
if (typeof body !== "string") {
throw new Error("body is missing");