Skip to content

Commit

Permalink
add ts-doc comment to getCloudflareContext function
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Sep 25, 2024
1 parent 6ea8d74 commit a83fba6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/cloudflare/src/api/get-cloudflare-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ export type CloudflareContext<

const cloudflareContextSymbol = Symbol.for("__cloudflare-context__");

/**
* Utility to get the current Cloudflare context.
*
* Such context contains three values:
* - `env`: object containing the worker's bindings
* (https://developers.cloudflare.com/workers/runtime-apis/bindings/)
* - `ctx`: the current execution context object
* (https://developers.cloudflare.com/workers/runtime-apis/context)
* - `cf`: object containing information regarding the current request
* (https://developers.cloudflare.com/workers/runtime-apis/request/#the-cf-property-requestinitcfproperties)
*
* @returns the cloudflare context
*/
export async function getCloudflareContext<
CfProperties extends Record<string, unknown> = IncomingRequestCfProperties,
Context = ExecutionContext,
Expand Down

0 comments on commit a83fba6

Please sign in to comment.