Skip to main content

Interface: RenderContext

core/core.RenderContext

A RenderContext is responsible for rendering an AI.JSX Node tree.

Hierarchy

Properties

[pushContextSymbol]

[pushContextSymbol]: <T>(context: Context<T>, value: T) => RenderContext

Type declaration

▸ <T>(context, value): RenderContext

An internal function used to set the value associated with a given context.

Type parameters
Name
T
Parameters
NameTypeDescription
contextContext<T>The context holder, as returned from createContext.
valueTThe value to set.
Returns

RenderContext

The new RenderContext.

Defined in

packages/ai-jsx/src/core/core.ts:169

Methods

getContext

getContext<T>(context): T

Gets the current value associated with a context.

Type parameters

Name
T

Parameters

NameTypeDescription
contextContext<T>The context holder, as returned from createContext.

Returns

T

Defined in

packages/ai-jsx/src/core/core.ts:155


render

render<TIntermediate>(renderable, opts?): RenderResult<TIntermediate, string>

Renders a value to a string, or if a stop function is provided, to an array of strings or Elements. The result can be awaited for the final result, or yielded from for intermediate results.

Type parameters

NameType
TIntermediatestring

Parameters

NameTypeDescription
renderableRenderableThe value to render.
opts?RenderOpts<TIntermediate, string>Additional options.

Returns

RenderResult<TIntermediate, string>

Defined in

packages/ai-jsx/src/core/core.ts:142

render<TIntermediate>(renderable, opts): RenderResult<TIntermediate, PartiallyRendered[]>

Type parameters

NameType
TIntermediatestring

Parameters

NameType
renderableRenderable
optsRenderOpts<TIntermediate, PartiallyRendered[]>

Returns

RenderResult<TIntermediate, PartiallyRendered[]>

Defined in

packages/ai-jsx/src/core/core.ts:146


wrapRender

wrapRender(getRenderer): RenderContext

Creates a new RenderContext by wrapping the existing render function.

Parameters

NameTypeDescription
getRenderer(r: StreamRenderer) => StreamRendererA function that returns the new renderer function.

Returns

RenderContext

Defined in

packages/ai-jsx/src/core/core.ts:161