[]previous and next page

tryGetRequestEvent

The event of the request being handled, or undefined outside a request or where the runtime has no AsyncLocalStorage.

The event of the request being handled, or undefined outside a request or where the runtime has no AsyncLocalStorage.

Import#

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

Signature#

ts
function tryGetRequestEvent(): RequestEvent | undefined

Returns#

The event, if any.

Examples#

ts
const user = tryGetRequestEvent()?.cookies.get("theme");