Skip to content

Documentation / @ripl/core / ContextExport

Interface: ContextExport ​

Defined in: packages/core/src/context/types.ts:180

Snapshot exporter returned by Context.export. Each method serializes the snapshot that was captured at the moment export() was called, so later mutations to the context do not affect the exported result. Contexts implement the formats relevant to them (see each context's export() for specifics); unsupported formats throw a descriptive error.

Methods ​

release()? ​

optional release(): void

Defined in: packages/core/src/context/types.ts:195

Releases anything the export is still holding — above all the object URL handed out by ContextExport.toURL, which is otherwise pinned for the document's lifetime. Optional, so an export that holds nothing may omit it; implementations must be safe to call repeatedly.

Returns ​

void


toImage() ​

toImage(): Promise<ImageData>

Defined in: packages/core/src/context/types.ts:189

Low-level, environment-agnostic pixel data. Promise-wrapped so contexts that must rasterize asynchronously (e.g. SVG) share one signature; pixel-backed contexts resolve immediately.

Returns ​

Promise<ImageData>


toString() ​

toString(): string

Defined in: packages/core/src/context/types.ts:182

The context's native string form: SVG markup, a PNG data URL, or terminal text.

Returns ​

string


toURL() ​

toURL(): string

Defined in: packages/core/src/context/types.ts:184

An openable Blob object URL: image/svg+xml for SVG, image/png for raster contexts.

Returns ​

string