Skip to content

Documentation / @ripl/core / ContextExport

Interface: ContextExport

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

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

toImage()

toImage(): Promise<ImageData>

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

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:147

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:149

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

Returns

string