[]previous and next page

waitUntil

Keeps promise running after the response is sent.

Keeps promise running after the response is sent. On a platform with ctx.waitUntil the request's platform hook is used; elsewhere the work simply continues in the process, and a failure is logged (it is never dropped).

Import#

ts
import { waitUntil } from "@shadow-js/dusk/server";

Signature#

ts
function waitUntil(promise: Promise<unknown>): void

Parameters#

Name Description
promise The background work.

Examples#

ts
export async function POST(event) { waitUntil(sendAuditLog(event)); return new Response(null, { status: 202 }); }