Skip to main content Link Search Menu Expand Document (external link)

RenderContext overview

The context in which templates are rendered within

Added in v1.0.0


Table of contents


utils

RenderContext

The context in which templates are rendered within

Signature

export declare const RenderContext: Context.Tagged<RenderContext, RenderContext>

Added in v1.0.0

RenderContext (interface)

The context in which templates are rendered within

Signature

export interface RenderContext {
  /**
   * The current environment we are rendering within
   */
  readonly environment: Environment

  /**
   * Cache for root Node's being rendered into.
   */
  readonly renderCache: WeakMap<object, Rendered | null>

  /**
   * Cache for individual templates.
   */
  readonly templateCache: WeakMap<TemplateStringsArray, Entry>
}

Added in v1.0.0

RenderContextOptions (type alias)

Signature

export type RenderContextOptions = {
  readonly environment: Environment
}

Added in v1.0.0

dom

Signature

export declare const dom: (
  window: Window & GlobalThis,
  options?: DomServicesElementParams
) => Layer.Layer<RenderContext | CurrentEnvironment | DomServices>

Added in v1.0.0

getRenderCache

Signature

export declare function getRenderCache<T>(renderCache: RenderContext["renderCache"], key: object): Option.Option<T>

Added in v1.0.0

getTemplateCache

Signature

export declare function getTemplateCache(
  templateCache: RenderContext["templateCache"],
  key: TemplateStringsArray
): Option.Option<Entry>

Added in v1.0.0

make

Signature

export declare function make({ environment }: RenderContextOptions): RenderContext

Added in v1.0.0

server

Signature

export declare const server: Layer.Layer<RenderContext | CurrentEnvironment, never, never>

Added in v1.0.0

static

Signature

export declare const static: Layer.Layer<RenderContext | CurrentEnvironment, never, never>

Added in v1.0.0