CloudflareWorkers constructor

Implementation

CloudflareWorkers({
  this.fetch,
  this.scheduled,
  this.email,
  this.durableObjects,
}) {
  // Setup the runtime environment.
  setupRuntime();

  // Attach the fetch handler to the global object.
  if (fetch != null) {
    attachFetchHandler(fetch!);
  }

  // Attach the scheduled handler to the global object.
  if (scheduled != null) {
    attachScheduledHandler(scheduled!);
  }

  // Attach the email handler to the global object.
  if (email != null) {
    attachEmailHandler(email!);
  }

  // Attach the durable objects to the global object, by name.
  if (durableObjects != null) {
    attachDurableObjects(durableObjects!);
  }
}