Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

LoaderContext interface

What a loader gets for one entry.

View as Markdown
import type { LoaderContext } from '@dioramajs/diorama/assets'
interface LoaderContext

Members

NameTypeDescription
readonly crossOriginCrossOrigin

CORS mode of the request.

readonly decodersReadonly<Partial<DecoderOptions>>

The app's decoder options. Unset fields take three's defaults.

readonly keystring

Cache key of the entry.

readonly optionsReadonly<Record<string, string | number | boolean>>

Loader options from load().

readonly priorityPriority

The highest priority among the entry's leases.

readonly signalAbortSignal

Aborts when the last lease goes before the load ends.

readonly urlstring

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.