Skip to content

ContextRenderer

reference
1 min readUpdated

Kind: Interface

Source: src/context.ts

Interface for context renderer.

ContextRenderer defines the contract for converting context data into rendered output. Implementations receive context from the surrounding system and return the representation consumed by the next stage.

Diagram

mermaid
graph LR
  Context[Context data] --> Renderer[ContextRenderer]
  Renderer --> Output[Rendered output]

Usage

ts
import type { ContextRenderer } from "./context";

const renderer: ContextRenderer = {
  render(context) {
    return JSON.stringify(context);
  },
};

const renderedContext = renderer.render({
  user: "Ada",
  action: "create",
});

console.log(renderedContext);

AI Coding Instructions

  • Implement the render method required by ContextRenderer.
  • Keep rendering logic focused on transforming the received context into output.
  • Do not mutate the input context while rendering.
  • Pass renderer implementations through the integration point that consumes rendered context.

Was this page helpful?

Download as PDF
ContextRenderer — Hono (narrator proof)