---
url: 'https://adk.nht.io/api/@nhtio/adk/batteries/type-aliases/WorkerResolver.md'
description: >-
  Bring-your-own Worker spawner — the first-class seam for handing {@link
  spawnIsolated}/[`createWorkerTransport`](https://adk.nht.io/api/@nhtio/adk/batteries/functions/createWorkerTransport) a `Worker` constructed however
  the caller's bundler/pooling strategy demands (a `new Worker(new URL(...),
  import.meta.url)` Vite/webpack pattern, a worker pool that recycles threads, a
  test harness's Blob-URL worker, etc.). Called once per `connect()` (including
  every `recycle()`) — see [`createWorkerTransport`](https://adk.nht.io/api/@nhtio/adk/batteries/functions/createWorkerTransport)'s remarks for why this
  makes a resolver the SINGLE source of Worker creation for a given transport.
---

# Type Alias: WorkerResolver

```ts
type WorkerResolver = (ctx: {
  spec: IsolatedServiceSpec;
}) => BrowserWorker | Promise<BrowserWorker>;
```

Defined in: [src/batteries/isolation/browser.ts:98](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/isolation/browser.ts#L98)

Bring-your-own Worker spawner — the first-class seam for handing [spawnIsolated](../functions/spawnIsolated.md)/[createWorkerTransport](../functions/createWorkerTransport.md) a `Worker` constructed however the caller's bundler/pooling strategy demands
(a `new Worker(new URL(...), import.meta.url)` Vite/webpack pattern, a worker pool that recycles
threads, a test harness's Blob-URL worker, etc.). Called once per `connect()` (including every
`recycle()`) — see [createWorkerTransport](../functions/createWorkerTransport.md)'s remarks for why this makes a resolver the SINGLE
source of Worker creation for a given transport.

## Parameters

| Parameter  | Type                                                                         |
| ---------- | ---------------------------------------------------------------------------- |
| `ctx`      | { `spec`: [`IsolatedServiceSpec`](../interfaces/IsolatedServiceSpec.md); } |
| `ctx.spec` | [`IsolatedServiceSpec`](../interfaces/IsolatedServiceSpec.md)                |

## Returns

| [`BrowserWorker`](../interfaces/BrowserWorker.md)
| `Promise`<[`BrowserWorker`](../interfaces/BrowserWorker.md)>
