# LoaderContext

interface in `@dioramajs/diorama/assets`

```ts
import type { LoaderContext } from '@dioramajs/diorama/assets'
```

What a loader gets for one entry.

```ts
interface LoaderContext
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `crossOrigin` | `CrossOrigin` | CORS mode of the request. |
| `decoders` | `Readonly<Partial<DecoderOptions>>` | The app's decoder options. Unset fields take three's defaults. |
| `key` | `string` | Cache key of the entry. |
| `options` | `Readonly<Record<string, string \| number \| boolean>>` | Loader options from `load()`. |
| `priority` | `Priority` | The highest priority among the entry's leases. |
| `signal` | `AbortSignal` | Aborts when the last lease goes before the load ends. |
| `url` | `string` | Absolute URL to load. |
| `bytes` | `bytes(response: Response): Promise<ArrayBuffer>` | Reads a body, counting bytes into the progress. |
| `decode` | `decode<R>(work: () => Promise<R>): Promise<R>` | Runs CPU-heavy work (createImageBitmap, parsing) in one of two decode slots and frees the request slot, so call it once the network part is done. Low-only entries wait while a pause is held. |
| `fetch` | `fetch(init?: RequestInit): Promise<Response>` | fetch() with the priority hint and signal. HTTP errors throw ASSET_LOAD. |
| `load` | `load<T = unknown>(url: string, options?: LoadOptions<string>): Asset<T>` | Loads a dependency. Its lease is released if this load is aborted, otherwise release it in `dispose`. Like `render()` it frees the request slot, so call both after the network part. |
| `render` | `render(): Promise<RenderApi>` | Resolves once `render` runs (after renderer.init()). |

Also exported from `@dioramajs/assets`.

Defined in [packages/assets/src/types.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/assets/src/types.ts#L97).
