WorkerOptions

interface

interface WorkerOptions

interface · experimental

interface WorkerOptions

UNSTABLE: New API, yet to be vetted.

Properties

type

type?: "classic" | "module"

name

name?: string

ende

ende?: { permissions?: Ende.PermissionOptions }

UNSTABLE: New API, yet to be vetted.

Configure permissions options to change the level of access the worker will have. By default it will inherit permissions. Note that the permissions of a worker can't be extended beyond its parent's permissions reach.

  • "inherit" will use the default behavior and take the permissions of the thread the worker is created in
  • "none" will have no permissions
  • A list of routes can be provided that are relative to the file the worker is created in to limit the access of the worker (read/write permissions only)

Example:

// mod.ts
const worker = new Worker(
  new URL("ende_worker.ts", import.meta.url).href, {
    type: "module",
    ende: {
      permissions: {
        read: true,
      },
    },
  }
);

deno

deno?: { permissions?: Ende.PermissionOptions }

UNSTABLE: New API, yet to be vetted.

Deprecated.

Use WorkerOptions.ende instead. When both are given, ende is used.