Env

Everything available to your Repeat at runtime!

The env object is passed as the second parameter to your Repeat’s event handlers & gives you access to storage, variables and various integrations.

Properties

  • variables: string
    • All of the variables for your Repeat are available under the env object, i.e env.variables.my_variable.

Methods

  • metrics
    • Read & write your Repeat’s metrics with the Metrics API.

  • storage
    • Read & write to your Repeat’s storage with the Storage API.

  • env.waitUntil(promise: Promise<any>)void
    • This method acceptes a Promise and is non-blocking, allowing you to return a Response and your Repeat will stay invoked until the Promises resolve.

      Example Usage

      This example will return "Hello world!" to the request without having to wait for the Discord webhook request to finish.

      export default {
      	async webhook(request: Request, env: Repeat.Env) {
      		env.waitUntil(
      			env.webhooks.discord(env.variables.DISCORD_WEBHOOK_URL,
      			`Received ${request.method} request to ${request.url}.`
      		)
      
      		return new Response("Hello world!")
      	},
      };
  • webhooks
    • Easily interact with other platforms, such as Discord, with our streamlined integrations.

    • Discord

 

 
 

Last updated on November 15, 2022