Interface: ComponentContext
core/core.ComponentContext
A context that is used to render an AI.JSX component.
Hierarchy
↳
ComponentContext
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
Name | Type | Description |
---|---|---|
context | Context <T > | The context holder, as returned from createContext . |
value | T | The value to set. |
Returns
The new RenderContext
.
Inherited from
RenderContext.[pushContextSymbol]
Defined in
packages/ai-jsx/src/core/core.ts:169
logger
• logger: Logger
Defined in
packages/ai-jsx/src/core/core.ts:15
Methods
getContext
▸ getContext<T
>(context
): T
Gets the current value associated with a context.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
context | Context <T > | The context holder, as returned from createContext . |
Returns
T
Inherited from
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 Element
s. The result can be await
ed for the final result, or
yielded from for intermediate results.
Type parameters
Name | Type |
---|---|
TIntermediate | string |
Parameters
Name | Type | Description |
---|---|---|
renderable | Renderable | The value to render. |
opts? | RenderOpts <TIntermediate , string > | Additional options. |
Returns
RenderResult
<TIntermediate
, string
>
Inherited from
Defined in
packages/ai-jsx/src/core/core.ts:142
▸ render<TIntermediate
>(renderable
, opts
): RenderResult
<TIntermediate
, PartiallyRendered
[]>
Type parameters
Name | Type |
---|---|
TIntermediate | string |
Parameters
Name | Type |
---|---|
renderable | Renderable |
opts | RenderOpts <TIntermediate , PartiallyRendered []> |
Returns
RenderResult
<TIntermediate
, PartiallyRendered
[]>
Inherited from
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
Name | Type | Description |
---|---|---|
getRenderer | (r : StreamRenderer ) => StreamRenderer | A function that returns the new renderer function. |