# Asset

interface in `@dioramajs/diorama/assets`

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

A lease, returned synchronously. The entry lives while any lease does. Calling it releases it.
`E` is the failure type, AssetError for `load()` and whatever `make` threw for `acquire()`.

```ts
Asset(): void
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `error` | `E \| undefined` | The failure while the lease is failed. |
| `key` | `string` | Cache key: type, URL, CORS mode and options. |
| `ready` | `Promise<T>` | Rejects with `E`, or with an unreported ASSET_ABORTED if released before ready. |
| `status` | `ReadonlySignal<AssetStatus>` | State of the lease. |
| `url` | `string` | Absolute URL. |
| `value` | `T \| undefined` | The value while the lease is ready, undefined before and after. |
| `dispose` | `dispose(): void` | Same as release, so `ctx.onDispose(asset)` ties it to an effect. |
| `release` | `release(): void` | Releases the lease. The entry goes when its last lease does. |

Also exported from `@dioramajs/assets`.

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